ASP.NET Wizard Control Oddness

Haven’t posted anything in over a year, but decided to break the silence to write about something that caused me to waste more time than it should have. Hopefully, it will save someone else (or future me) from wasting more time on it.

I’m developing an ASP.NET site using the Wizard control and have code that saves the user’s progress in a database. The idea here is that the user can return to the site and pick up where they left off. Simple enough, but I got caught in what seemed like a never ending debugging session when I couldn’t figure out why the "Previous" button didn’t work when I came back into the site to resume a previous session. The wizard simply would not step backwards when starting on any step in the middle. To make a long story short, turns out the genius at Microsoft who implemented this control decided to make the "previous" button work like the browser "back" button, i.e. clicking previous steps you back in your "history" since you starting using the wizard. In this case, there is no "history" when starting in the middle, so the button does nothing! Not at all intuitive.

I found this discussion enlightening:

The workaround is simple. Handle the PrevousButtonClick event and decrement the ActiveStepIndex property:

protected void MainWizard_PreviousButtonClick(object sender, WizardNavigationEventArgs e) { MainWizard.ActiveStepIndex--; }

Hope this helps.