This documentation is archived and is not being maintained.

Wizard Class

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

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public class Wizard extends CompositeControl
<asp:Wizard />

You can use the 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 Wizard control is made up of the following components:

  • A 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 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.


    If you are using Microsoft Visual Studio 2005, note that the ActiveStepIndex is persisted in Source view. If you change the WizardSteps property in Design view by clicking the sidebar buttons, and you then run the page, the first step of the Wizard control might not be shown because the ActiveStepIndex might be pointing to a different step.

Each of the steps in the Wizard control has a StepType property that determines the kind of navigation functionality that the step has. If you do not specify a value for the StepType property, the default value is Auto. The following table lists the available settings for the 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 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 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 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 NextButtonClick event is raised, you should set the AllowReturn property of the 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 Wizard control inherits the following command names from the View class and MultiView class: NextViewCommandName, PreviousViewCommandName, SwitchViewByIDCommandName, and 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 Wizard control, no exception is thrown. For example, if the StartNavigationTemplate button is missing a value for CommandName, no exception is thrown.

You can use the MoveTo method or the ActiveStepIndex property to dynamically change the step that is currently displayed in the Wizard control.


If you programmatically add a WizardStep in the Page_Load event handler, you must add the navigation to that step prior to the page loading.

The appearance of the Wizard control is fully customizable through templates, skins, and style settings. For example, you can use the HeaderTemplate, SideBarTemplate, StartNavigationTemplate, FinishNavigationTemplate, and StepNavigationTemplate properties to customize the interface of the Wizard control.


Setting the FinishNavigationTemplate, DisplaySideBar, HeaderTemplate, SideBarTemplate, StartNavigationTemplate, or StepNavigationTemplate property recreates the child controls of the 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 Wizard control's child controls explicitly, or avoid putting controls inside of templates.

Note that the 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 Wizard control, use the XHTML doc type, which is added by default in Visual Web Developer and Visual Studio.


The markup rendered by default for this control might not conform to accessibility standards such as the Web Content Accessibility Guidelines 1.0 (WCAG) priority 1 guidelines. For example, using CancelDestinationPageUrl or FinishDestinationPageUrl result in a page refresh which is contrary to the accessibility requirement to not refresh a page when clicking a button or link on a page. For details about accessibility support for this control, see ASP.NET Controls and Accessibility.

How to: Customize the ASP.NET CreateUserWizard ControlBuilding ASP .NET Web Applications
How to: Customize the ASP.NET CreateUserWizard ControlBuilding ASP .NET Web Applications
Walkthrough: Creating a Basic ASP.NET Wizard ControlBuilding ASP .NET Web Applications in Visual Studio
Walkthrough: Advanced Use of the ASP.NET Wizard ControlBuilding ASP .NET Web Applications in Visual Studio

The following code example demonstrates how to define a Wizard control to collect a user's name and address, with the option to enter a separate shipping address. If the user does not select SeparateShippingCheckBox, thereby issuing a request to add a separate shipping address, the Wizard control moves directly from Step2 to Finish. On the Finish step, the user has the option to return to the beginning of the Wizard control by clicking GoBackButton; however, it takes the user to Step2 because the AllowReturn property for Step1 is set to false.

Security noteSecurity Note:

This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

The following code example is the code-behind file for the Web page used in the preceding example.

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0