1. Using FindControl function
string username = ((TextBox)PreviousPage.FindControl("tbxUsername")).Text;
2. Using Strongly Typed Data
I personally like this one because I don't care about what the control name is. Also, no typo mistakes will be made.
Here is how to make a strongly typed data
public string UserName
{
get{return tbxUsername.Text;}
}
Also we have to set the code below at the page that receives the posted data.
<%@ PreviousPageType VirtualPath="~/pageName.aspx" %>
Last step, you have to rebuild in order for page to see the property in receiver page.
No comments:
Post a Comment