how to pass value from first form to second form?

Discussion in 'ASP .Net' started by =?Utf-8?B?YzY3NjIyOA==?=, Jan 11, 2006.

  1. Hi,
    This is my first time to post asp.net question on this forum.
    I have a question for "How to pass the first form value to the next form"
    I have enrollinfo.aspx form which look like as follow:
    <form id="Form1" method="post" runat="server">
    <Subway:Address id="address" runat="server" Caption="Home
    Address"></Subway:Address>
    <p></p>
    <SUBWAY:pEOPLEINFO id="Peopleinfo" runat="server"
    Caption="Employee Information"></SUBWAY:pEOPLEINFO>
    <p></p>
    <asp:hyperlink id=Dependentlink runat="server" text="Add
    Dependents" NavigateUrl="Peopleinfo1.aspx?SSN=" >
    </asp:hyperlink>
    </form>
    The address and peopeleinfo are two user controls.(they are textboxes which
    will collect some information from users)
    When user click "add dependents" link, I want Social security number for a
    specific person on this form will be attached
    to the Peopleinfo1.aspx, so later on in the database all those dependents
    will be attached to this principal person's information. but I don't know how
    to check this value if it is filled out/right or not in the second form(
    peopleinfo1.aspx),
    Any clue? I am just a beginer for asp.net

    Thanks
    Betty
    --
    Betty
     
    =?Utf-8?B?YzY3NjIyOA==?=, Jan 11, 2006
    #1
    1. Advertising

  2. I believe this contains an example that will solve your problem:
    http://SteveOrr.net/faq/PassValues.aspx

    And here's another 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
    besides the querystring there are 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 more good articles on the subject:
    http://www.aspalliance.com/kenc/passval.aspx
    http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx

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


    "c676228" <> wrote in message
    news:...
    > Hi,
    > This is my first time to post asp.net question on this forum.
    > I have a question for "How to pass the first form value to the next form"
    > I have enrollinfo.aspx form which look like as follow:
    > <form id="Form1" method="post" runat="server">
    > <Subway:Address id="address" runat="server" Caption="Home
    > Address"></Subway:Address>
    > <p></p>
    > <SUBWAY:pEOPLEINFO id="Peopleinfo" runat="server"
    > Caption="Employee Information"></SUBWAY:pEOPLEINFO>
    > <p></p>
    > <asp:hyperlink id=Dependentlink runat="server" text="Add
    > Dependents" NavigateUrl="Peopleinfo1.aspx?SSN=" >
    > </asp:hyperlink>
    > </form>
    > The address and peopeleinfo are two user controls.(they are textboxes
    > which
    > will collect some information from users)
    > When user click "add dependents" link, I want Social security number for a
    > specific person on this form will be attached
    > to the Peopleinfo1.aspx, so later on in the database all those dependents
    > will be attached to this principal person's information. but I don't know
    > how
    > to check this value if it is filled out/right or not in the second form(
    > peopleinfo1.aspx),
    > Any clue? I am just a beginer for asp.net
    >
    > Thanks
    > Betty
    > --
    > Betty
     
    Steve C. Orr [MVP, MCSD], Jan 11, 2006
    #2
    1. Advertising

  3. Thank you so much. The information is so through and I will take a look at it.
    --
    Betty


    "Steve C. Orr [MVP, MCSD]" wrote:

    > I believe this contains an example that will solve your problem:
    > http://SteveOrr.net/faq/PassValues.aspx
    >
    > And here's another 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
    > besides the querystring there are 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 more good articles on the subject:
    > http://www.aspalliance.com/kenc/passval.aspx
    > http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    > "c676228" <> wrote in message
    > news:...
    > > Hi,
    > > This is my first time to post asp.net question on this forum.
    > > I have a question for "How to pass the first form value to the next form"
    > > I have enrollinfo.aspx form which look like as follow:
    > > <form id="Form1" method="post" runat="server">
    > > <Subway:Address id="address" runat="server" Caption="Home
    > > Address"></Subway:Address>
    > > <p></p>
    > > <SUBWAY:pEOPLEINFO id="Peopleinfo" runat="server"
    > > Caption="Employee Information"></SUBWAY:pEOPLEINFO>
    > > <p></p>
    > > <asp:hyperlink id=Dependentlink runat="server" text="Add
    > > Dependents" NavigateUrl="Peopleinfo1.aspx?SSN=" >
    > > </asp:hyperlink>
    > > </form>
    > > The address and peopeleinfo are two user controls.(they are textboxes
    > > which
    > > will collect some information from users)
    > > When user click "add dependents" link, I want Social security number for a
    > > specific person on this form will be attached
    > > to the Peopleinfo1.aspx, so later on in the database all those dependents
    > > will be attached to this principal person's information. but I don't know
    > > how
    > > to check this value if it is filled out/right or not in the second form(
    > > peopleinfo1.aspx),
    > > Any clue? I am just a beginer for asp.net
    > >
    > > Thanks
    > > Betty
    > > --
    > > Betty

    >
    >
    >
     
    =?Utf-8?B?YzY3NjIyOA==?=, Jan 11, 2006
    #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:
    6
    Views:
    2,157
    Steve C. Orr [MVP, MCSD]
    Aug 9, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,069
    weiwei
    Jan 5, 2007
  3. Raymond O'Connor
    Replies:
    1
    Views:
    169
    Raymond O'Connor
    Mar 8, 2007
  4. yelipolok
    Replies:
    4
    Views:
    287
    John W. Krahn
    Jan 27, 2010
  5. Replies:
    5
    Views:
    118
Loading...

Share This Page