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

プロパティ値

WizardStepBase コントロールに現在表示されている Wizard のインデックス。

属性

例外

選択した値が、WizardSteps コレクションで定義されたウィザード ステップの数を超えています。

次のコード例では、 プロパティを使用してコントロールの ActiveStepIndex プロパティを ActiveStep 設定する方法を Wizard 示します。 の CheckBox1.Checked 値が trueの場合、 ActiveStep プロパティは に Wizard1.Step3設定されます。それ以外の ActiveStep 場合、プロパティは に 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 制御するプロパティをプログラムで設定できます。

Note

Visual Studio 2005 Microsoft使用している場合は、 がソース ビューに保持されることにActiveStepIndex注意してください。 サイドバー ボタンをWizardStepsクリックしてデザイン ビューのプロパティを変更し、ページを実行すると、 が別のステップを指している可能性があるためActiveStepIndex、コントロールのWizard最初のステップが表示されないことがあります。

既定で手順のないウィザードをサポートするように の ActiveStepIndex 値を -1 に設定すると、次の動作が発生します。

  • 宣言によって -1 に設定 ActiveStepIndex するか、既定値として -1 に設定すると、コントロールは常にウィザードの最初の手順をレンダリングしようとします。

  • プログラムで -1 に設定 ActiveStepIndex した場合、コントロールはレンダリングされません。

このプロパティは、テーマまたはスタイル シート テーマによって設定することはできません。 詳細については、「テーマとスキンの ASP.NET」を参照してくださいThemeableAttribute

適用対象

こちらもご覧ください