Aracılığıyla paylaş


Wizard.ActiveStepIndex Özellik

Tanım

Geçerli WizardStepBase nesnenin dizinini alır veya ayarlar.

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

Özellik Değeri

Şu anda denetimde Wizard görüntülenen diziniWizardStepBase.

Öznitelikler

Özel durumlar

Seçilen değer, koleksiyonda tanımlanan sihirbaz adımı sayısından WizardSteps daha yüksek.

Örnekler

Aşağıdaki kod örneği, denetimin ActiveStepIndex özelliğini ayarlamak ActiveStep için özelliğinin Wizard nasıl kullanılacağını gösterir. değeri CheckBox1.Checked ise trueActiveStep özelliği olarak ayarlanırWizard1.Step3; aksi takdirde ActiveStep özelliği olarak Wizard1.Step2ayarlanır.

<%@ 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>

Açıklamalar

özelliği, ActiveStepIndex şu anda denetimde görüntülenen nesnenin WizardStepBase sıfır tabanlı dizinini Wizard sağlar. Çalışma zamanında kullanıcıya hangi adımın ActiveStepIndex görüntüleneceğini denetlemek için özelliğini program aracılığıyla ayarlayabilirsiniz.

Not

Microsoft Visual Studio 2005 kullanıyorsanız Kaynak görünümünde kalıcı olduğunu unutmayın ActiveStepIndex . Kenar çubuğu düğmelerine WizardSteps tıklayarak Tasarım görünümünde özelliği değiştirirseniz ve sayfayı çalıştırırsanız, denetimin Wizard ilk adımı farklı bir adıma işaret ediyor olabileceğinden gösterilmeyebilir ActiveStepIndex .

varsayılan olarak adım olmadan bir sihirbazı desteklemek için değerini ActiveStepIndex -1 olarak ayarlarsanız, aşağıdaki davranış oluşur:

  • Bildirim temelli olarak -1 olarak ayarlarsanız ActiveStepIndex veya varsayılan değer olarak -1 olarak ayarlarsanız, denetim her zaman sihirbazdaki ilk adımı işlemeyi dener.

  • Program aracılığıyla -1 olarak ayarlarsanız ActiveStepIndex denetim işlenmez.

Bu özellik temalar veya stil sayfası temaları tarafından ayarlanamaz. Daha fazla bilgi için bkz ThemeableAttribute . temalar ve dış görünümler ASP.NET.

Şunlara uygulanır

Ayrıca bkz.