Multistep webform 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?

Thanks
Ram

5 Comments

  • I would store teh "temp" values i nthe database and tehn once complete move the values into the final table

  • Look at the Microsoft User Interface Process Application Block, I believe it has support for wizards and will allow you to easily support other interface requirements later.

  • As far as I'm aware, setting a panel or user control's Visible property to false won't destroy the viewstate for that object... (the visible property itself is going to be part of the viewstate)... so you should just be able to select the appropriate panel to display for that particular page.

  • Colt,



    Thanks for the link and it was indeed a well written article on this subject.



    James,

    I was thinking whenever you change the "visible" property of any control that will affect the viewstate and let me try that again.



    Otherwise I am planning to use Cache object to store the information instead of viewstate which will solve my data persistance problem.

  • 1. Take a look at UI block version 1.0 not 2.0, which has all the implementation for your requirement. It will store all the user entered values in MS SQL and the user can come back in different session and start the work where he/she left off. Version 2.0 wizard navigation will support only WinForms not WebForms. I think version 1.0 is better than version2.0, since Microsoft is itself not very clear, in which direction the UI will go.

    2. Also Viewstate is another possible approach, but in this, instead of keeping the viewstate in the page, store it in DB which will not affect the perf



    My $0.02

    Kasi

Comments have been disabled for this content.