Archive for September, 2006

Asp:Wizard – Hiding a WizardStep

I recently had a need to turn off a WizardStep on a registration page I am constructing for one of our new business products.    Unfortunately, there is no Visibility member provided on the WizardStep to hide it or any other obvious way to disable it.  The first bright idea, simply removing the step from the Wizard worked, but had the unfortunate side affect of wiping out the current viewstate.


The next idea, which worked better than expected, was to change the current step when a certain condition was met.

     if (INeedToSkipThisStep)
          if (wzRegister.ActiveStep.ID.Equals(“wsStore”))  // If this is the step to be skipped

Two important points to note:

  1. This logic must be located in the Page_LoadComplete event.  The ActiveStep is not switched to the current step until this point. 
  2. I originally thought I would have to handle the previous button differently using a chunk of code like the following, but it turned out to be unnecessary.  The Wizard control was smart enough to know that this step was not visited and does not step into it when using the Previous button.

    ArrayList historyList = (ArrayList) wzRegister.GetHistory();
    WizardStepBase lastStep = (WizardStepBase) historyList[0];

     if (lastStep.ID.Equals(“wsStepAfterStore”))


Read Full Post »