Help!! passing data from the form through page???
-
In 1.aspx page I have a form:
I want passing data when user submit to the 2.aspx page. How a programer .net usually do it? Have anyone help me please?
Although I do not recommend this approach to coding in ASP.NET, you can use the Server.Transfer method to expose the sending page to the receiving page. Using this method can lead to some misleading results in your web browser. Specifically, the address bar in your web browser will still show the address of the sending page, even though the receiving page's content is being displayed. If possible, I would have the code-behind for the initial page handle the processing of its own data and redirect to subsequent pages as needed.
-
Although I do not recommend this approach to coding in ASP.NET, you can use the Server.Transfer method to expose the sending page to the receiving page. Using this method can lead to some misleading results in your web browser. Specifically, the address bar in your web browser will still show the address of the sending page, even though the receiving page's content is being displayed. If possible, I would have the code-behind for the initial page handle the processing of its own data and redirect to subsequent pages as needed.
-
Thanks, But How do I save the value from the form to another page aspx? EX: txtName.value txtAddress.value In 2.aspx I can't call that...
ASP.NET TextBox Web Controls store their value in the Text property not the Value property. If the textbox controls are not available for processing in 2.aspx. You can push the values of the text boxes into Session variables and access them from any subsequent page (2.aspx, 3.aspx, etc.) In the postback event for 1.aspx, capture the values for your text controls and redirect. C#:
Session["1aspx_txtName"] = txtName.Text;
Session["1aspx_txtAddress"] = txtAddress.Text;
Response.Redirect["2.aspx"];Session("1aspx_txtName") = txtName.Text
Session("1aspx_txtAddress") = txtAddress.Text
Response.Redirect("2.aspx")The session variables will be available for the extent of the users connection to the web site. Subsequent pages may access the values in the following manner. C#:
String previousName = (String)Session["1aspx_txtName"];
txtNewAddress.Text = (String)Session["1aspx_txtAddress"];Dim previousName as String = CType(Session("1aspx_txtName"),String)
txtNewAddress.Text = CType(Session("1aspx_txtAddress"),String)You will want to limit the number of Session variables you create. They will take up memory on you server until unloaded when the users leaves the site.