I saw my team mates develop wizards in our web-based application development project, that involved multiple steps, back & forth movement (with "next" and "back" buttons), and data being saved only in the last step.
I saw them code to persist data across pages (steps of the wizard) and in the process loaded the Session object.
I always wondered if ASP.NET's viewstate capabilities be put to good use! Some conceptual thinking resulted that use of "Panel" web control could be a boon!
Zooooom came an opportunity, thanks to an enhancement request from the client! :)
I was assigned a fairly simple wizard with about 4 steps. The methodology, I followed was this.
1. For every step of the wizard, I put a Panel web control.
2. One Set of "Cancel", "Next", "Back" & "Save" buttons at the bottom.
3. In the event handlers of these buttons, hide/unhide the panels and hide/unhide the buttons.
4. In the last step, unhide Save button and in the event handler, you have access to all the data across steps with no hassles!
The user gets a feel that each step is a different page, but as a developer, I had an easy time! Across the steps, I did just nothing to persist data. ASP.NET ViewState did it for me!
And at the last click, I had all the data in page to be saved! No hassles!
WizardDemo.Zip (22 KB)
This article was contributed by Rajiv. R and he can be reached at email@example.com.