|
If u want to transfer the values from one page to another u can either use server.transfer method or u can use response.redirect method with strings of values attached which u want in the other page. i will give sample code.
Source Web Form
private void Button1_Click
(object sender, System.EventArgs e)
{
string url;
url="anotherwebform.aspx?name=" + TextBox1.Text + "&email=" + TextBox2.Text;
Response.Redirect(url);
}
Destination Web Form
private void Page_Load
(object sender, System.EventArgs e)
{
Label1.Text=Request.QueryString["name"];
Label2.Text=Request.QueryString["email"];
}
Or
Source Web Form
Add following properties to the web form:
public string Name
{
get
{
return TextBox1.Text;
}
}
public string EMail
{
get
{
return TextBox2.Text;
}
}
Now, call Server.Transfer.
private void Button1_Click
(object sender, System.EventArgs e)
{
Server.Transfer("anotherwebform.aspx");
}
Destination Web Form
private void Page_Load
(object sender, System.EventArgs e)
{
//create instance of source web form
WebForm1 wf1;
//get reference to current handler instance
wf1=(WebForm1)Context.Handler;
Label1.Text=wf1.Name;
Label2.Text=wf1.EMail;
}
Vipin
|
|
|
|
|
thnx , but actually i didn't understand the second part ,
i know how to use server.transfer but i didn't understand that context .& stuff ...
can you explain more ?
& i have an other problem , even when i use that server....
this prob is : keeping the same url
i have 2 pages : the first named FirstPage.aspx & the second called SecondPage.aspx
in the first i have a textbox & a button & in the second i have a label
so i want when i click the button in the first page the value in the text box been sent into the sencond page
private sub button_click()
server.transfer(secondpage.aspx) isn't it ?
end sub
in the second i request this value by writing :
label1.text = Request.form("textbox1").tostring()
the problem is that when i click that button in the first page i get the result in the label, but the browser keeps the same url i mean that it keep the url for the first page , it doesn't change it to the secondpage.aspx & i don't understand why , can you tell me why ?
i hope i was clear , i don't think so but i hope so
thank you very much , waiting for your answer
try to be good if you can't be the best
-- modified at 8:35 Tuesday 18th July, 2006
|
|
|
|
|
the main advantage of using server.transfer is to transfer the content from one page to another without being shown in the url. and because of that the url will not change. if u want the url to be changed when u click the then u will have to use the response.redirect.
Vipin
|
|
|
|
|
How to retrieve data from GridView cell when bound field property visible is set to false ? When i'm calling GridView1.SelectedRow.Cells[1].Text i'm getting empty string. Please help
StonePit
|
|
|
|
|
u should take GridView1.SelectedRow.Cells[0] and not GridView1.SelectedRow.Cells[1]
Vipin
|
|
|
|
|
gridview has selection enabled so .cells[0] is null I have found temporery solution for my problem. If gridview column has property visible set to false it wont be databinded.
GridView1.Columns[1].visible = true;
GridView1.Databind();
Now GridView1.SelectedRow.Cells[1].Text have value. I'm still waiting for any other ideas.
StonePit
|
|
|
|
|
+ You can access from the datasource which is bound to the gridview, it means you need to repopulate the datasource.
+ You can persist the value bound to the invisible bound field somewhere else so that you can access it later, for example in the DataKeys collection, in an extra column which you can make it invisible at the client side with the style settings.
+ Keep using the current column, but instead of using the Visible property to hide the column, you can set the style to make it invisible.
Just some ideas.
|
|
|
|
|
set cssClass attribute of ControlStyle, Footerstyle, HeaderStyle and ItemStyle to "NonVisibleText" (without quotes)....
this worked for me
-- modified at 16:26 Sunday 19th November, 2006
you should put this in your html:
.NonVisibleText
{
color: Black;
font-family: Verdana, Arial, Tahoma, Sans-Serif;
display:none;
}
|
|
|
|
|
Hi everybody,
i have a little problem, i deployed an application "web services" in my provider. this application should get data from a data base already deployed also. the problem is that i can't get the data, the connexion to the web services goes just fine but i have an error telling me that the data are in format HTML and not XML.
Have an idea??? i need some help please
Thanks
|
|
|
|
|
Often when you receive an error indicating the response is in HTML format and not in XML format you are receiving a server error. A server error will be returned in HTML format because it doesn't know or care that you are trying to reach a web service. These errors are often service unavailable, access denied, or file not fount type of errors. Can you use a debugger or an HTTP sniffer to get the exact data that is being returned?
Jim Conigliaro
jconigliaro@ieee.org
|
|
|
|
|
hi,
I create datalist,
what mistake this code,
Dim oBut As ImageButton = CType(datagrid1.Items(datagrid1.SelectedIndex).FindControl("image"), ImageButton).Attributes.Add("onMouseOver", "window.open('webform1.aspx');"))
Error is end of statement expected
thanks
|
|
|
|
|
I think you have an extra closing bracket.
|
|
|
|
|
What mistake? It's VB
|
|
|
|
|
you must first set the variable:
Dim oBut As ImageButton = CType(datagrid1.Items(datagrid1.SelectedIndex).FindControl("image"), ImageButton)
then execute the attributes.add method:
oBut.Attributes.Add("onMouseOver", "window.open('webform1.aspx');")
daniero
|
|
|
|
|
Hi ,
i have posted this question before & i reposted it , now i need the answer please ,i really need it i swear cuz i'm building an asp.net application & i have to finish it .
well,i will explain to make it more clear :
i want that when i type a letter or a number or whatever in ma textbox , this letter appear in a label , i mean once i type the letter , i want that letter appear in ma label
i hope uyou understand i think it is clear
i initialized the autopostback propriety of ma textbox into true but it works just when the focus leave the text box not for each letter
try to be good if you can't be the best
|
|
|
|
|
You need to do this in javascript probably. Use the onKeyUp event.
|
|
|
|
|
thnx man , but can you give me a clear example because i heard before that i have to use javascript but the problem is that nobody told me how ?
thank you again
try to be good if you can't be the best
|
|
|
|
|
Mohammed Amine wrote: nobody told me how
WHy don't you try figuring it out on your own rather than expecting people to give you the answers. There are many resources available to learn Javascript.
|
|
|
|
|
Mohammed Amine wrote: i have posted this question before & i reposted it , now i need the answer please
This isn't a help desk and your not asking your professor, although he is probably monitoring.
|
|
|
|
|
From the posts it seems that you need the javascript solution.
Let the textbox id be txt1
The asp:label that you are using transforms into a <span>
let its id be lbl1
then write something like
document.getElementById("lbl1").innerHTML = document.getElementById("txt1").value;
I think this will do your job.
Thanks,
Pradipta Basu
|
|
|
|
|
ok, thank you i want to try it but can you tell me where should i write this line ? & can you try to explain a little bit please like that i will be sure of ma self
thank you very much
try to be good if you can't be the best
|
|
|
|
|
You can look at the code below. Hope this will solve your problem.
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <br />
<br />
<html><br />
<head><br />
<title>Test</title><br />
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"><br />
<meta name="CODE_LANGUAGE" Content="C#"><br />
<meta name=vs_defaultClientScript content="JavaScript"><br />
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"><br />
<script type="text/javascript"><br />
<!--<br />
function setValue()<br />
{<br />
document.getElementById("lblName").innerHTML = document.getElementById("txtName").value;<br />
}<br />
</script><br />
</head><br />
<body><br />
<br />
<form id="Form1" method="post" runat="server"><br />
<asp:TextBox ID="txtName" Runat="server" onkeyup="Javascript:setValue();"></asp:TextBox><br /><br />
<asp:Label ID="lblName" Runat="server" /><br />
<br />
</form><br />
<br />
</body><br />
</html><br />
Save this in a aspx file and then run. Note that it is not using any code-behind.
Thanks
Pradipta Basu
|
|
|
|
|
Hi , thank you very much man i appreciate your help , but i will annoy you a little bit , please can you explain that line to me ?
what is the role of innerHTML ?
the necessary is understanding that line ok ?? pleaaaaase & thank you very very much
try to be good if you can't be the best
|
|
|
|
|
|
For IE you can also use innerText. But it won't work in Mozilla. So using innerHTML is better.
Thanks,
Pradipta Basu
|
|
|
|