Passing Data to Page

  • Thread starter Thread starter Jonathan Wood
  • Start date Start date
J

Jonathan Wood

I'm new to ASP.NET and am trying to create some of my first Web pages.

I'd like the user to enter about a dozen fields, and then have another page
create a table based on the information entered.

What is the best way to forward the data from the first page to the second?
Is the Session object the best way to handle this data?

Also, I will of course need a way for the second page to intelligently
handle missing data, or when the user goes directly to the second page,
bypassing the first.

Thanks.

Jonathan
 
Try this instead:

1. Create a new page
2. Add two panels, the first called pnlForm, the other called pnlComplete
(use whatever names you like)
3. Set both panels to Visible=false to start
4. In Page_Load set pnlForm to visible=true

VB.NET
If Not (Page.IsPostback) Then
pnlForm.Visible = true
pnlComplete.Visible = false
End If

5. In the click event for the form, do this

pnlForm.Visible = false
pnlCOmplete.Visible = true'

Then, write code to bind the data based on the form submit. If you do it
this way, you have the code in one place, which is much easier to use.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
For the stuff I'm working on, the user has the option of entering
information on up to five items. I think the technique you described might
work nicely for display fields for one item at a time.

I think for the results page though, I'd still like a separate page.

Does the Session object make sense in this case?
 
Back
Top