See Also: Wizard Members
In this topic:
You can use the System.Web.UI.WebControls.Wizard control to:
Collect related data across multiple steps.
Break up a larger Web page used to collect user input into smaller logical steps.
Allow for either linear or nonlinear navigation through the steps.
The System.Web.UI.WebControls.Wizard control is made up of the following components:
A System.Web.UI.WebControls.WizardStepCollection collection of steps that contain the user interface for each step, as defined by the page developer.
Built-in navigation capabilities that determine the appropriate buttons to display based on the WizardStepBase.StepType value.
A header area that can be customized to display information specific to the step that the user is currently on.
A sidebar area that can be used to quickly navigate to steps in the control.
Each of the steps in the System.Web.UI.WebControls.Wizard control has a WizardStepBase.StepType property that determines the kind of navigation functionality that the step has. If you do not specify a value for the WizardStepBase.StepType property, the default value is WizardStepType.Auto. The following table lists the available settings for the WizardStepBase.StepType property and the resulting behavior of the step.
The navigation UI that is rendered for the step is determined by the order in which the step is declared.
The step is the last one to appear. No navigation buttons are rendered.
The step is the last one that collects user data. The Finish button is rendered for navigation.
The step is the first one to appear. A Previous button is not rendered.
The step is any step between the first and last. Previous and Next buttons are rendered for navigation.
Using the System.Web.UI.WebControls.Wizard control, data can be collected through linear or nonlinear navigation. Some examples of nonlinear navigation are skipping unnecessary steps or returning to a previously completed step to change some value. The System.Web.UI.WebControls.Wizard control maintains its state between steps, so the data entered on a step does not need to be persisted to a data store until all the steps of the System.Web.UI.WebControls.Wizard control have been completed.
Alternatively, if you want to persist the collected data to a data store as each step is completed, such as when the Wizard.NextButtonClick event is raised, you should set the WizardStepBase.AllowReturn property of the System.Web.UI.WebControls.WizardStepBase object to false so that the user cannot return to a previously completed step and change the data once it has been submitted.
The System.Web.UI.WebControls.Wizard control inherits the following command names from the System.Web.UI.WebControls.View class and System.Web.UI.WebControls.MultiView class: MultiView.NextViewCommandName, MultiView.PreviousViewCommandName, MultiView.SwitchViewByIDCommandName, and MultiView.SwitchViewByIndexCommandName. The Wizard control ignores these command names and does not include any special logic to enable these commands to automatically work for navigation. If a command name is removed or is missing from a button in the System.Web.UI.WebControls.Wizard control, no exception is thrown. For example, if the Wizard.StartNavigationTemplate button is missing a value for Button.CommandName, no exception is thrown.
If you programmatically add a System.Web.UI.WebControls.WizardStep in the Page_Load event handler, you must add the navigation to that step prior to the page loading.
The appearance of the System.Web.UI.WebControls.Wizard control is fully customizable through templates, skins, and style settings. For example, you can use the Wizard.HeaderTemplate, Wizard.SideBarTemplate, Wizard.StartNavigationTemplate, Wizard.FinishNavigationTemplate, and Wizard.StepNavigationTemplate properties to customize the interface of the System.Web.UI.WebControls.Wizard control.
Setting the Wizard.FinishNavigationTemplate, Wizard.DisplaySideBar, Wizard.HeaderTemplate, Wizard.SideBarTemplate, Wizard.StartNavigationTemplate, or Wizard.StepNavigationTemplate property recreates the child controls of the System.Web.UI.WebControls.Wizard control. As a result, the view state for the child controls is lost in the process. To avoid this situation, explicitly maintain the control state of the System.Web.UI.WebControls.Wizard control's child controls explicitly, or avoid putting controls inside of templates.
Note that the System.Web.UI.WebControls.Wizard control does not support special Microsoft Internet Explorer rendering for non-standard or quirks mode. To get the best Internet Explorer rendering using the System.Web.UI.WebControls.Wizard control, use the XHTML doc type, which is added by default in Visual Web Developer and Visual Studio.
The System.Web.UI.WebControls.Wizard control lets you specify the layout of the control without requiring you to use an HTML table element. Instead, you can use a LayoutTemplate element to specify the layout. In the template, you create placeholder controls to indicate where items should be dynamically inserted into the control. (This is similar to how the template model for the System.Web.UI.WebControls.ListView control works.) For more information, see the Wizard.LayoutTemplate property.
For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.
<asp:Wizard AccessKey="string" ActiveStepIndex="integer" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="