I have three ASP.net pages in Visual Studio, and I need to pass some variables, mostly ints and doubles, between them. I am using C#. Thanks for the answers.
How to pass variables between ASP.net pages?
The easiest way is to just use a Querystring variable.
int MyNumber = 5;
Response.Redirect(String.Format("page2... MyNumber));
To retrieve a querystring variable, simply use Request.QueryString("VariableName");
You could also place your variables in hidden form fields and use Request.Form() to retrieve them.
Some people find it easiest to simply store them as session variables, but I find this to be rather inefficient and a poor practice.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment