can we transfer data from one page to another page using
viewstate if so how?if not y?
Answer Posted / sujata
A) yes we can do it by
1)Server.transfer(“Default2.aspx”);
2)with postbackURL property in the button event.
Source Page:
protected void Page_Load(object sender, EventArgs e)
{
if (ViewState["NameOfUser"] != null)
Label1.Text = ViewState["NameOfUser"].ToString();
else
Label1.Text = "Not set yet...";
}
protected void Button1_Click(object sender, EventArgs e)
{
ViewState["NameOfUser"] = TextBox1.Text;
Label1.Text = TextBox1.Text;
Server.Transfer("Default2.aspx"); //Response.Redirect("Default2.aspx");(Cannot do wit response.redirect")
}
Target Page:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(((Label)PreviousPage.FindControl("Label1")).Text);
Label1.Text =" " + ((Label)PreviousPage.FindControl("Label1")).Text;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is in a session cookie?
Why do we need a web application session?
Which browsers support the xmlhttprequest object?
How does asp net store session ids by default?
How ViewstateMac works?
How can we use Web API with ASP.NET Web Form?
benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks
How can I configure asp.net applications that are running on a remote machine?
What are standard controls?
List the types of authentication supported by asp.net?
Explain asp.net web forms.
Explain the asp.net session state modes.
What is a server cookie?
We Only Know The Total Number Of Feet In The Farmyard. Write A Program that will compute the total number of rabbits and chickens in the farmyard. Assume number of feet in the farmyard are 40. how many rabbits and chickens are?
Do you support digital rights management to protect my videos?