WizardStepCollection.Add メソッド
アセンブリ: System.Web (system.web.dll 内)



Add メソッドは、WizardStepCollection コレクションの末尾に WizardStepBase の派生オブジェクトを追加します。WizardStepBase の派生オブジェクトをコレクションの特定のインデックス位置に追加するには、AddAt メソッドを使用します。

プログラムによって Wizard コントロールを作成し、Add メソッドを使用して WizardStepBase の派生 WizardStep オブジェクトを WizardSteps コレクションに追加する方法を次のコード例に示します。この例では、Wizard コントロールの WizardSteps プロパティは、WizardStepCollection クラスのインスタンスです。
<%@ 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> <body> <form id="Form1" runat="server"> <h3>WizardSteps Example</h3> <asp:PlaceHolder id="PlaceHolder1" runat="server" /> </form> </body> </html>
<%@ 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> <body> <form id="Form1" runat="server"> <h3>WizardSteps Example</h3> <asp:PlaceHolder id="PlaceHolder1" runat="server" /> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- WizardStepCollection.Add メソッドのページへのリンク