WizardStepCollection クラス
アセンブリ: System.Web (system.web.dll 内)
構文
解説WizardStepCollection クラスは、ウィザードとして機能するコントロール (CreateUserWizard コントロールや Wizard コントロールなど) の WizardStepBase の派生オブジェクトのコレクションを格納したり管理したりするために使用されます。たとえば、Wizard コントロールは、その WizardSteps プロパティに WizardStepCollection クラスを使用します。
WizardStepCollection 内の WizardStepBase の派生オブジェクトにアクセスするには、次に示すような複数の方法があります。
-
0 から始まるインデックスの特定の位置にある WizardStepBase の派生オブジェクトを直接取得するには、Item プロパティを使用します。
-
WizardStepCollection コレクションの内容を Array オブジェクトにコピーするには、CopyTo メソッドを使用します。
使用例宣言構文を使用して WizardStepCollection コレクションを設定する方法を次の例に示します。
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <body> <form id="form1" runat="server"> <asp:Wizard id="Wizard1" runat="server" > <WizardSteps> <asp:WizardStep id="Step1" runat="server" title="Step 1"> </asp:WizardStep> <asp:WizardStep id="Step2" runat="server" title="Step 2"> </asp:WizardStep> <asp:WizardStep id="Step3" runat="server" title="Step 3"> </asp:WizardStep> <asp:WizardStep id="Step4" runat="server" title="Step 4"> </asp:WizardStep> <asp:WizardStep id="Step5" runat="server" title="Step 5"> </asp:WizardStep> <asp:WizardStep id="Step6" runat="server" title="Step 6"> </asp:WizardStep> </WizardSteps> <HeaderTemplate> <b>WizardStepCollection Example</b> </HeaderTemplate> </asp:Wizard> </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"> <html > <body> <form id="form1" runat="server"> <asp:Wizard id="Wizard1" runat="server" > <WizardSteps> <asp:WizardStep id="Step1" runat="server" title="Step 1"> </asp:WizardStep> <asp:WizardStep id="Step2" runat="server" title="Step 2"> </asp:WizardStep> <asp:WizardStep id="Step3" runat="server" title="Step 3"> </asp:WizardStep> <asp:WizardStep id="Step4" runat="server" title="Step 4"> </asp:WizardStep> <asp:WizardStep id="Step5" runat="server" title="Step 5"> </asp:WizardStep> <asp:WizardStep id="Step6" runat="server" title="Step 6"> </asp:WizardStep> </WizardSteps> <HeaderTemplate> <b>WizardStepCollection Example</b> </HeaderTemplate> </asp:Wizard> </form> </body> </html>
プログラムによって WizardStepCollection コレクションを設定する方法を次の例に示します。
<%@ Page Language="VB" CodeFile="WizardStepCollection.vb" Inherits="WizardStepCollectionvb_aspx" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <body> <form id="Form1" runat="server"> <h3>WizardStepCollection Example</h3> <asp:PlaceHolder id="PlaceHolder1" runat="server" /> </form> </body> </html>
<%@ Page Language="C#" CodeFile="WizardStepCollection.cs" Inherits="WizardStepCollectioncs_aspx" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <body> <form id="Form1" runat="server"> <h3>WizardStepCollection Example</h3> <asp:PlaceHolder id="PlaceHolder1" runat="server" /> </form> </body> </html>
前の例の Web ページ用の分離コード ファイルを次に示します。
Partial Class WizardStepCollectionvb_aspx Inherits System.Web.UI.Page Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) ' Programmatically create a wizard control. Dim Wizard1 As Wizard = New Wizard() ' Create steps for the wizard control and insert them ' into the WizardStepCollection collection. For i As Integer = 0 To 5 Dim newStep As WizardStepBase = New WizardStep() newStep.ID = "Step" + (i + 1).ToString() newStep.Title = "Step " + (i + 1).ToString() Wizard1.WizardSteps.Add(newStep) Next ' Display the wizard control on the Web page. PlaceHolder1.Controls.Add(Wizard1) End Sub End Class
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class WizardStepCollectioncs_aspx : System.Web.UI.Page { void Page_Load(object sender, EventArgs e) { // Programmatically create a wizard control. Wizard Wizard1 = new Wizard(); // Create steps for the wizard control and insert them // into the WizardStepCollection collection. for (int i = 0; i <= 5; i++) { WizardStepBase newStep = new WizardStep(); newStep.ID = "Step" + (i + 1).ToString(); newStep.Title = "Step " + (i + 1).ToString(); Wizard1.WizardSteps.Add(newStep); } // Display the wizard control on the Web page. PlaceHolder1.Controls.Add(Wizard1); } }
.NET Framework のセキュリティ
継承階層System.Web.UI.WebControls.WizardStepCollection
スレッド セーフ
プラットフォーム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 クラスのページへのリンク