Wizard.ActiveStep Property
Gets the step in the WizardSteps collection that is currently displayed to the user.
Assembly: System.Web (in System.Web.dll)
'Declaration <BrowsableAttribute(False)> _ Public ReadOnly Property ActiveStep As WizardStepBase 'Usage Dim instance As Wizard Dim value As WizardStepBase value = instance.ActiveStep
Property Value
Type: System.Web.UI.WebControls.WizardStepBaseThe WizardStepBase that is currently displayed to the user.
| Exception | Condition |
|---|---|
| InvalidOperationException | 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="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Sub OnActiveStepChanged(ByVal sender As Object, ByVal e As EventArgs) ' 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.Equals(Me.WizardStep2) Then If (Me.CheckBox1.Checked) Then Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.WizardStep3) End If End If End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</title> </head> <body> <form id="form1" runat="server"> <asp:Wizard ID="Wizard1" Runat="server" OnActiveStepChanged="OnActiveStepChanged"> <WizardSteps> <asp:WizardStep ID="WizardStep1" Title="Step 1" Runat="server"> <asp:CheckBox ID="CheckBox1" Runat="Server" Text="Check this checkbox to skip Step 2." /> You are currently on Step 1. </asp:WizardStep> <asp:WizardStep ID="WizardStep2" Title="Step 2" Runat="server"> You are currently on Step 2. </asp:WizardStep> <asp:WizardStep ID="WizardStep3" Runat="server" Title="Step 3"> You are currently on Step 3. </asp:WizardStep> </WizardSteps> <HeaderTemplate> <b>ActiveStepIndex Example</b> </HeaderTemplate> </asp:Wizard> </form> </body> </html>
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.