Passing a variable to another page

Discussion in 'ASP .Net' started by Ricardo, Feb 8, 2005.

  1. Ricardo

    Ricardo Guest

    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...
    Ricardo, Feb 8, 2005
    #1
    1. Advertising

  2. Look up the concept of querystrings

    --
    Regards

    John Timney
    ASP.NET MVP
    Microsoft Regional Director

    "Ricardo" <> wrote in message
    news:%...
    > 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...
    >
    >
    John Timney \(ASP.NET MVP\), Feb 8, 2005
    #2
    1. Advertising

  3. 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/issues/03/04/ASPNETUserState/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" <> wrote in message
    news:%...
    > 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...
    >
    >
    Steve C. Orr [MVP, MCSD], Feb 9, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    358
    bruce barker
    Nov 5, 2004
  2. Robert Cohen
    Replies:
    3
    Views:
    248
    Andrew Durstewitz
    Jul 15, 2003
  3. J P Singh
    Replies:
    2
    Views:
    114
    Michael
    Jan 28, 2004
  4. Oscar
    Replies:
    27
    Views:
    468
    Mark J. McGinty
    Jun 1, 2005
  5. Davide Bruzzone
    Replies:
    2
    Views:
    234
    Davide Bruzzone
    Aug 4, 2003
Loading...

Share This Page