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 the use of execute non query in asp.net?
What is a page life cycle?
Explain server side state management system.
What is break mode?
Explain the updatepanel?
Explain the difference between debug.write and trace.write?
How Session use Cookies in State Management?
When using the Pager object, inorder to know which page to go, which property you have to set to grid?
Should I delete cookies?
Why is xap important?
What is the difference between asp.net mvc and asp.net webforms? : asp.net mvc
What are session and cookies?
What is difference between cache and session?
how to elimainte the similar data from the different tables
Define page output caching?