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 方法将 对象添加到WizardStepBase集合。WizardSteps

<%@ 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 主题和外观

适用于

另请参阅