passing values between pages

fguihen

Junior Contributor
Joined
Nov 10, 2003
Messages
248
Location
Eire
i have two web forms pages.
how do i append values to the querystring in the first page, and then extract them on the second page?
i know its easy to pass values in web form pages using properties, but i want to do it using the query string appended to the URL. i want to know how to pass values in from one html page to another and then display the 2nd page. thanks for any help
 
You just need to change the form method to 'GET' and the values would be appended to the URL.

But be careful as there is limitation on the length of the data can posted using GET method.

Then you can use Request.QueryString("ParameterName') to retrieve the value.








HTH.
 
just one more thing. how do i send and use data in the next page using the POST method ?
 
That's all great and well for ASP 3.0 but in .NET we tend to use more modern techniques such as Dim s As String = Request.QueryString for getting values from the query string. Since controls in ASP.NET or view state driven you really don't need to have a 'POST' and 'GET' methods. If you are doing this you are using ASP.NET in the wrong way and should continue using ASP 3.0 or earlier.

If you have a spefic parameter (such as link that opens a certain window upon clicking) you would either

A) Set the action in the OnClick event if it's a link button, or the action necessary depending on the control type.
B) If it's data driven use a combination of the CommandArgument/Command Name

You can also you Context if you want to persist properties from one page to another or Session or Cookies. I wouldn't rely on Session too heavily and unless you're in a controlled environment I wouldn't use cookies since many people have them turned off.
 
Back
Top