Re: Retrieving value from a textbox in another web form

Discussion in 'ASP .Net' started by Steve C. Orr, MCSD, Jul 22, 2003.

  1. 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.dotnetjunkies.com/tutorials.aspx?tutorialid=600

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

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net


    "Justin" <> wrote in message
    news:047201c34feb$80ede8d0$...
    > hi, thanks for reading this msg. I got a problem here.
    > There are 2 webforms, one is the login and the other is
    > the result page after login. After a user sucessfully
    > login, i need the user's ID which were entered from the
    > textbox in the login page to display its relevant data...
    >
    > I tried:
    >
    > 1. using property, it worked well if the result page just
    > load the data out, but currently in my result page the
    > users need to select some option first before showing the
    > data. If I use this method, error:
    >
    > Public ReadOnly Property Property1() As String
    > Get
    > Return tbStaffID.Text
    >
    > End Get
    > End Property
    >
    > 2. I also tried using querystring...but i can't refer the
    > value in the textbox to the querystring even I use a
    > variabe
    >
    > Server.Transfer("Results.aspx?tbStaffID&tbName")
    >
    > - What are your comments regrading the codes or do u hav
    > any better suggestion on other ways how to solve it? Thank
    > you
     
    Steve C. Orr, MCSD, Jul 22, 2003
    #1
    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. tom
    Replies:
    4
    Views:
    9,931
    S. Justin Gengo
    Nov 13, 2003
  2. Replies:
    5
    Views:
    801
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Jun 12, 2007
  3. Jordan S.
    Replies:
    3
    Views:
    871
    Juan T. Llibre
    Apr 19, 2008
  4. J

    Display in another window and retrieving value

    J, Sep 9, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    112
  5. Rob R. Ainscough
    Replies:
    3
    Views:
    378
    Rob R. Ainscough
    Jun 14, 2005
Loading...

Share This Page