Re submitting to the same form

G

Guest

Hi,

I'm building a web form utilizing ASP.NET and VB.NET. The web form has three
pages:
1. The first page has a set of text boxes that a user has to fill out and
then hit the next button. Once this is done the form has to resubmits to
itself and if all the required data is entered it displays the next page.
2. The second page is another input screen. When the user has completed
filling out the required fields on the page the user hits a submit button and
the form resubmits to it self and stores a set of data to a database. The
form then moves on to display the next page.
3. The third page displays some output text to the screen including thankyou
details.

Please note I want the form to resubmit to the same page.

I have a good background in ASP (have built similar online applications
before in ASP) also have read 'Essential ASP.NET' by Fritz Onion (loved it -
has helped me so much) also have just grabbed 'ASP.NET unleashed' by Stephen
Walther.

Here is the question.
How do I move through these screens with ASP.NET. Or another way to ask the
questions how do I display the different page formats after the user has hit
the next and submit buttons (and possibly previous with the second page). I’m
very confused with the framework requirements. Could someone please help?

Thank you in advance,
George.
 
G

garethdjames

The simple and prescribed way of doin this is to actually only use one
aspx page.

Have three panels on this page, by default have panel 1 set to visible
and 2 and 3 set to not visible,

Panel 1 contains the first input controls, panel 2 contains the second
etc. etc.

Then when you do a post back (when the first panel is visible) simply
make the first panel not visible and the second visible,

On the second post back (check if the second panel is visible to test
if it is the second postback), save the state to the DB, the state from
the first input will still be in the control collection.

Finaly display the third panel (making 1 and 2 not visible)
 
G

Guest

Hi George,

Postback is the standard behavoiur of asp.net pages for the majority of web
control events (if not all) such as a button submit on a web form. During the
postback you can perform the necessarry form validation or have validation
controls do this for you and then transfer the user to trhe next page if
validation passes. You can use the Response.Redirect(), Server.Transfer() or
Server.Execute() methods to do this which are similar to those is ASP. Each
has their own pros and cons so it's worth checking the MSDN. Generally
Response.Redirect() is probably the easiest but will involve and additional
round trip between the client and server and form post details will be lost
during the redirect.

Hope this helps, Andy
 

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,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top