How do I pass form data between pages?

There are quite a number of ways to do this and depending on the task at hand, you would probably want to use a different method. If you are thinking of passing form data to another page for Ex 3 it’s actually not necessary, you can place it all in one page.

1. QueryString - Put it in the URL

In the button onclick event, you can Response.Redirect to another page placing the variables in the URL.

e.g.
String strURL = String.Concat(”results.aspx?name=”, txtName.Text, “&age=”, txtAge.Text);
Response.Redirect(strURL);

Then on your results.aspx page you can call Request.Params[”name”] to get the name and Request.Params[”age”] to get the parameters.

Posted by Mahesh ( Tryangled )

Leave a Reply

You must be logged in to post a comment.