PlatinumBay wrote:
Jason,
You have a couple options:
You can call set the variables in the session state, and call
Response.Redirect to send the browser to the new page.
You can call Server.Transfer and the context will apply to the new page.
You can call Response.Redirect and pass the parameters in the querystring.
Hope this helps,
Steve
"Jason Huang" <Ja************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Hi,
In my .Net 2.0 C# web form Form1, say I have a button btnToForm2.
Is the Request.Redirect("Form2") the right way to go to the Form2 in the
btnToForm2_Click event?
Actually, I also want to pass a parameter from the Form1 to Form2, do I
need to declare a global variable for storing?
Thanks for help.
Jason
Hello.
I agree with Steve.
Just keep in mind these considerations when deciding which of the three
approaches to use.
1. About storing variables in the session - it is good approach if using
just variables. If you plan to store some objects like tables and so on,
you should not forget about the overhead this is going to cause (thus
probably delaying your application execution time).
2. About the Server.Transfer method. Since the way this method works you
won't be able to click the "back" button and return to the first form.
That's why I don't like this approach.
3. Passing your variables in the query string is fine if they are
meaningless. I mean that choosing to pass information in this way
everyone would be able to see it, since everyone is able to see the
connection string.
Greetings!
Dimitar V.