共用方式為


Wizard.WizardSteps 屬性

定義

取得包含所有為控制項所定義之 WizardStepBase 物件的集合。

public:
 virtual property System::Web::UI::WebControls::WizardStepCollection ^ WizardSteps { System::Web::UI::WebControls::WizardStepCollection ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.Themeable(false)]
public virtual System.Web.UI.WebControls.WizardStepCollection WizardSteps { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.Themeable(false)>]
member this.WizardSteps : System.Web.UI.WebControls.WizardStepCollection
Public Overridable ReadOnly Property WizardSteps As WizardStepCollection

屬性值

WizardStepCollection,表示所有為 WizardStepBase 所定義的 Wizard 物件。

屬性

範例

下列程式代碼範例示範如何以程序設計方式建立 Wizard 控件,以及如何使用 Add 方法將物件新增 WizardStepBaseWizardSteps 集合。

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

  // Programmatically create a Wizard control and dynamically
  // add WizardStep objects to it.    
  
  void Page_Load(object sender, EventArgs e) 
  {
    Wizard WizardControl = new Wizard();
      
    // Create some steps for the wizard and add them
    // to the Wizard control.
    for (int i = 0; i <= 5; i++)
    {
      WizardStepBase newStep = new WizardStep();
      newStep.ID = "Step" + (i + 1).ToString();
      WizardControl.WizardSteps.Add(newStep);
    }
    
    // Display the wizard on the page.
    PlaceHolder1.Controls.Add(WizardControl);
  }
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardSteps Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardSteps Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </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">
  
  ' Programmatically create a Wizard control and dynamically
  ' add WizardStep objects to it.    
  
  Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
      
    Dim WizardControl As New Wizard()
      
    ' Create some steps for the wizard and add them to 
    ' the Wizard control.
    For i As Integer = 0 To 5
      Dim newStep As WizardStepBase = New WizardStep()
      newStep.ID = "Step" + (i + 1).ToString()
      WizardControl.WizardSteps.Add(newStep)
    Next
    
    ' Display the wizard on the page.
    PlaceHolder1.Controls.Add(WizardControl)
        
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardSteps Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardSteps Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </form>
  </body>
</html>

備註

屬性會WizardSteps傳回組成 Wizard 控件的物件WizardStepBase集合。 您可以使用 WizardSteps 集合,以程式設計方式存取 WizardStepBase 控制項中包含的 Wizard 物件。 Add使用、 RemoveClearInsert 方法,以程式設計方式操作WizardStepBase集合中的物件。

注意

如果您使用 Microsoft Visual Studio 2005,請注意,會 ActiveStepIndex 保存在 [來源] 檢視中。 如果您按下提要字段按鈕來變更 WizardSteps [設計] 檢視中的屬性,然後執行頁面,則可能不會顯示控件的第一個步驟 Wizard ,因為 ActiveStepIndex 可能指向不同的步驟。

Wizard如果控件包含多個WizardStepCollection集合,集合將會合併。

這個屬性無法由佈景主題或樣式表主題設定。 如需詳細資訊,請參閱 ThemeableAttributeASP.NET 主題和外觀

適用於

另請參閱