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
Why is this service branded with windows livetm?
How do I open an ashx file in windows 7?
Which is faster union or union all?
What is the procedure to handle the process request using mhpm events fired? : asp.net mvc
Differentiate the session object and application object?
How many types of session in ASP.NET
Can you explain one critical mapping? Performance issue which one is better? Whether connected lookup tranformation or unconnected one?
What is a viewstate?
What are the built-in objects in asp.net?
What is voluum?
Can you change a Master Page dynamically at runtime?
What is server side in asp.net?
Explain the concept of event bubbling in ASP.NET?
How to reduce the width of textbox in editcommandcolumn of datagrid?
List the advantages and disadvantages of user control an custom control?