This documentation is archived and is not being maintained.

Wizard.ActiveStepIndex Property

Gets or sets the index of the current WizardStepBase object.

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

<ThemeableAttribute(False)> _
Public Overridable Property ActiveStepIndex As Integer
<asp:Wizard ActiveStepIndex="Int32" />

Property Value

Type: System.Int32
The index of the WizardStepBase that is currently displayed in the Wizard control.


The selected value is higher than the number of wizard steps defined in the WizardSteps collection.

The ActiveStepIndex property provides the zero-based index of the WizardStepBase object that is currently displayed in the Wizard control. You can programmatically set the ActiveStepIndex property to control which step is displayed to the user at run time.


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.

If you set the value of ActiveStepIndex to -1 to support a wizard with no steps by default, the following behavior occurs:

  • If you declaratively set ActiveStepIndex to -1 or set it to -1 as a default value, the control will always try to render the first step in the wizard.

  • If you programmatically set ActiveStepIndex to -1, the control will not render.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

The following code example demonstrates how to use the ActiveStepIndex property to set the ActiveStep property of the Wizard control. If the value of CheckBox1.Checked is true, the ActiveStep property is set to Wizard1.Step3; otherwise, the ActiveStep property is set to Wizard1.Step2.

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">

  Sub OnActiveStepChanged(ByVal sender As Object, ByVal e As EventArgs)
    ' If the ActiveStep is changing to Step2, check to see whether the 
    ' CheckBox1 CheckBox is selected.  If it is, skip to the Step3 step. 
    If (Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.WizardStep2)) Then
      If (Me.CheckBox1.Checked) Then
        Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.WizardStep3)
      End If
    End If
  End Sub


<html xmlns="" >
  <head runat="server">
    <title>ASP.NET Example</title>
      <form id="form1" runat="server">
        <asp:Wizard id="Wizard1" 
            <asp:WizardStep id="WizardStep1" 
              title="Step 1" 
              <asp:CheckBox id="CheckBox1" 
                text="Select this check box to skip Step 2." />
                You are currently on Step 1.
            <asp:WizardStep id="WizardStep2" 
              title="Step 2" 
              You are currently on Step 2.
            <asp:WizardStep id="WizardStep3" 
              title="Step 3">
              You are currently on Step 3.
            <b>ActiveStepIndex Example</b>

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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