Wizard.ActiveStep Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the step in the WizardSteps collection that is currently displayed to the user.

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

public WizardStepBase ActiveStep { get; }

Property Value

Type: System.Web.UI.WebControls.WizardStepBase

The WizardStepBase that is currently displayed to the user.

Exception Condition

The corresponding ActiveStepIndex is less than -1 or greater than the number of WizardStepBase objects in the Wizard.

The ActiveStep property returns the WizardStepBase object that is currently displayed in the Wizard control. The ActiveStep property is read-only; however, you can use the ActiveStep property to access the properties of the current WizardStepBase object. Use the ActiveStepIndex property to dynamically change the ActiveStep to a different WizardStepBase object. Alternatively, you can use the MoveTo method to dynamically set the ActiveStep property.

The following code example demonstrates how to use the ActiveStep property to determine which step to set as the next 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="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  void OnActiveStepChanged(object sender, EventArgs e)
    // If the ActiveStep is changing to Step2 check to see if the 
    // CheckBox1 CheckBox is checked.  If it is then skip 
    // to the Step3 step.
    if (Wizard1.ActiveStep == this.WizardStep2)
      if (this.CheckBox1.Checked)
        Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(this.WizardStep3);


<html xmlns="http://www.w3.org/1999/xhtml" >
  <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="Check this checkbox 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
Available since 2.0
Return to top