how to pass value from first form to second form?

G

Guest

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
 
S

Steve C. Orr [MVP, MCSD]

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top