Wizard.ActiveStepIndex 속성

정의

현재 WizardStepBase 개체의 인덱스를 가져오거나 설정합니다.

public:
 virtual property int ActiveStepIndex { int get(); void set(int value); };
[System.Web.UI.Themeable(false)]
public virtual int ActiveStepIndex { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.ActiveStepIndex : int with get, set
Public Overridable Property ActiveStepIndex As Integer

속성 값

Int32

WizardStepBase 컨트롤에 현재 표시된 Wizard의 인덱스입니다.

특성

예외

선택한 값이 WizardSteps 컬렉션에서 정의한 마법사 단계의 수보다 큰 경우

예제

다음 코드 예제에서는 컨트롤의 ActiveStepIndex 속성을 설정 ActiveStep 하는 속성을 사용 하는 방법을 보여 줍니다 Wizard . 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 whether the 
    // CheckBox1 CheckBox is selected.  If it is, skip to the Step2 step.
    if (Wizard1.ActiveStepIndex == Wizard1.WizardSteps.IndexOf(this.WizardStep2))
    {
      if (this.CheckBox1.Checked)
      {
        Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(this.WizardStep3);
      }
    }
  }
  
</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="Select this check box 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>
<%@ 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 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
  
</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="Select this check box 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>

설명

이 속성은 ActiveStepIndex 현재 컨트롤에 표시되는 개체의 WizardStepBase 인덱스(0부터 시작하는 인 Wizard 덱스)를 제공합니다. 런타임에 ActiveStepIndex 사용자에게 표시되는 단계를 제어하도록 속성을 프로그래밍 방식으로 설정할 수 있습니다.

참고

Microsoft Visual Studio 2005 ActiveStepIndex 를 사용하는 경우 원본 뷰에 유지됩니다. 디자인 보기에서 사이드바 단추를 클릭하여 속성을 변경 WizardSteps 한 다음 페이지를 실행하는 경우 컨트롤이 다른 단계를 가리키고 있기 때문에 ActiveStepIndex 컨트롤의 Wizard 첫 번째 단계가 표시되지 않을 수 있습니다.

기본적으로 단계가 없는 마법사를 지원하도록 값을 ActiveStepIndex -1로 설정하면 다음 동작이 발생합니다.

  • 선언적으로 -1로 설정 ActiveStepIndex 하거나 기본값으로 -1로 설정하는 경우 컨트롤은 항상 마법사의 첫 번째 단계를 렌더링하려고 합니다.

  • 프로그래밍 방식으로 -1로 설정 ActiveStepIndex 하면 컨트롤이 렌더링되지 않습니다.

이 속성은 테마 또는 스타일시트 테마에 의해 설정될 수 없습니다. 자세한 내용은 ThemeableAttribute 하 고 ASP.NET 테마 및 스킨합니다.

적용 대상

추가 정보