By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,248 Members | 882 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,248 IT Pros & Developers. It's quick & easy.

Passing a variable to another page

P: n/a
How can I navigate to another page via a button, and pass a variable to this
next page...

How can I do this via that method that I see in other sites that the url
goes like this:

http://www.google.com.br/search?hl=pt-BR
[]s...
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Look up the concept of querystrings

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Ricardo" <r_******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
How can I navigate to another page via a button, and pass a variable to this next page...

How can I do this via that method that I see in other sites that the url
goes like this:

http://www.google.com.br/search?hl=pt-BR
[]s...

Nov 19 '05 #2

P: n/a
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Ricardo" <r_******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
How can I navigate to another page via a button, and pass a variable to
this
next page...

How can I do this via that method that I see in other sites that the url
goes like this:

http://www.google.com.br/search?hl=pt-BR
[]s...

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.