You can pass values from one page to another using Request.Params collection which returns collection of Form elements, Cookies, Server Variables and QueryString.
Home.aspx page:
Home.aspx page:
private void Submit_Click(object sender, System.EventArgs e) { System.Collections.Specialized.NameValueCollection myCol = Request.Params; string userName = Request.Params.Get("tbUserName"); Server.Transfer("Registration.aspx"); }And the Registration.aspx which will receive the values looks something like this:
private void Page_Load(object sender, System.EventArgs e) { if(Request.Params.Get("txtUserName") != null) { string userName = Request.Params.Get("tbUserName"); Response.Write(userName); } }
Note: Use Server.Transfer for redirecting to the next page otherwise the ControlList
values of the 1st page will be lost.
No comments:
Post a Comment