Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Multistep form submission

Here is my requirement.

I need to collect lots of data from the user for our intranet application and store them in DB only if they provide all the required information. I am planning to use wizard kind of UI where the user has to navigate through each step and enter all the required information and Submit will happen in the last step. I am planning to use Usercontrols in panels in one aspx page for each step to collect inputs.

Now the question is how do you persist previous step(usercontrols) data til your reach final step for submission.

1) Session is one option if the size of data is small but in this case, it can be huge
2) Viewstate is another option but again I am doubtful whether it will persist the data when it is not posted back - that is I will show only one user control at any point of time and hide all the other user controls and so other controls will not be posted back. Otherwise I need to keep track of all the "value entered" usercontrols and keep posting back each one whenever I move to another step!!

Any other options?


Friday, May 21, 2004

If you think it's too big for session, why in god's name would you want it in viewstate? So your users could wait 2 minutes per page?

We wrote our own wizard framework, and we essentially stash things in the cache. It works very well. If the user leaves the page in the middle of the wizard, then their data is eventually timed out and thrown out of the cache.

The only downside is that users must perform each step of the wizard within 20 minutes (which means if they start the wizard and then go to lunch, they'll have to start over again). We haven't had any complaints with this system.

Brad Wilson (
Saturday, May 22, 2004

How about for each form, use POST, and then each subsequent page writes a bunch of 'hidden' input tags with the details they have previously entered. On the final page all the details will be submitted. However, if the data is huge, your pages will take a long time to load after the first few.

Why not store the data server side, and have it time out after say an hour?

Yellow Belly
Saturday, May 22, 2004


I totally missed the option of storing the information in data Cache and I am going to try that.

Yellow belly,
We thought about hidden fields initially but that will make the page loading slow(same as viewstate). Other option we thought of saving each step info in the db temp tables and move everything into real tables once all required fields are entered and passed the validation and clean the data from temp.

But here is a good article by Michele on this issue and it is a well-written article and explains about the new Wizard control in the next ASP.NET version 'Whidbey'

Saturday, May 22, 2004

Brad Wilson, well at the other extreme you'll want to back each stage to the db backend until you have everything (and flick a DONE switch, like so: UPDATE tableFormSubmits SET Done = 1 WHERE SubmitID = '')

Li-fan Chen
Sunday, May 23, 2004

I haven't tried this, but it seems like Server.Transfer is made for wizards. As I understand it, all variables are available to subsequent pages and the URL stays the same.

Bill Brown
Sunday, May 23, 2004

*  Recent Topics

*  Fog Creek Home