System.Web.UI.WebControls.Wizard Class

Provides navigation and a user interface (UI) to collect related data across multiple steps.

See Also: Wizard Members

Syntax

[System.Web.UI.ToolboxData("<{0}:Wizard runat="server"> <WizardSteps> <asp:WizardStep title="Step 1" runat="server"></asp:WizardStep> <asp:WizardStep title="Step 2" runat="server"></asp:WizardStep> </WizardSteps> </{0}:Wizard>")]
[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.WizardDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.Bindable(false)]
[System.ComponentModel.DefaultEvent("FinishButtonClick")]
public class Wizard : CompositeControl

Remarks

In this topic:

Introduction

You can use the System.Web.UI.WebControls.Wizard control to:

Wizard Components

The System.Web.UI.WebControls.Wizard control is made up of the following components:

Wizard Steps

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.

WizardStepType.Auto

The navigation UI that is rendered for the step is determined by the order in which the step is declared.

WizardStepType.Complete

The step is the last one to appear. No navigation buttons are rendered.

WizardStepType.Finish

The step is the last one that collects user data. The Finish button is rendered for navigation.

WizardStepType.Start

The step is the first one to appear. A Previous button is not rendered.

WizardStepType.Step

The step is any step between the first and last. Previous and Next buttons are rendered for navigation.

Collecting Wizard Data

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.

Wizard Command Names

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.

Dynamically Changing Steps

You can use the Wizard.MoveTo(WizardStepBase) method or the Wizard.ActiveStepIndex property to dynamically change the step that is currently displayed in the System.Web.UI.WebControls.Wizard control.

Note:

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.

Wizard Appearance

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.

Note:

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.

Formatting Using Layout Templates

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.

Accessibility

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.

Declarative Syntax

Example

<asp:Wizard
    AccessKey="string"
    ActiveStepIndex="integer"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0