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

Dim index As Integer Dim returnValue As Boolean returnValue = Me.AllowNavigationToStep(index)
戻り値
渡されたインデックスが、既にアクセスされている WizardStepBase を参照しており、その AllowReturn プロパティが false に設定されている場合は false。それ以外の場合は true。

AllowNavigationToStep メソッドは、protected 修飾子を持つため、派生クラスからのみアクセスできます。派生クラスでは、AllowNavigationToStep メソッドを使用することにより、渡されるインデックスを使用して ActiveStepIndex プロパティを設定できるかどうかを判断できます。渡されたインデックスが、既にアクセスされている WizardStepBase オブジェクトを参照しており、その AllowReturn プロパティが false に設定されている場合、AllowNavigationToStep メソッドは false を返します。それ以外の場合は true を返します。

CustomWizard という名前の派生クラスを作成して、OnSideBarButtonClickメソッドをオーバーライドする方法を次のコード例に示します。CustomWizard コントロールのサイドバー領域のボタンをクリックすると、選択したステップにアクセスできるかどうかを確認するために、AllowNavigationToStep メソッドが呼び出されます。発生した処理をユーザーに通知するメッセージが本体の Web ページに書き込まれます。
<%@ 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"> ' This custom wizard control defines the OnSideBarButtonClick method ' that uses the AllowNavigationToStep method to determine whether the ' value passed in can be used to set the ActiveStepIndex property. Class CustomWizard Inherits Wizard Protected Overloads Sub OnSideBarButtonClick(ByVal sender As Object, _ ByVal e As WizardNavigationEventArgs) Handles Me.SideBarButtonClick If AllowNavigationToStep(e.NextStepIndex) Then Me.Page.Response.Write("AllowNavigationToStep() returned true, moving to Step" & _ (e.NextStepIndex + 1).ToString() & ".") Me.ActiveStepIndex = e.NextStepIndex Else Me.Page.Response.Write("AllowNavigationToStep() returned false for Step" & _ (e.NextStepIndex + 1).ToString() & ", moving to Step2.") Me.ActiveStepIndex = 1 End If End Sub End Class ' Add the custom wizard control to the page. Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim WizardControl As New CustomWizard() WizardControl.ID = "WizardControl" ' Create some steps for the custom wizard. For i As Integer = 0 To 5 Dim newStep As New WizardStep() newStep.ID = "Step" & (i + 1).ToString() ' Set AllowReturn to false for some of the steps. If ((i Mod 2) = 0) Then newStep.AllowReturn = False End If ' Add each step to the custom wizard. 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>AllowNavigationToStep 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"> // This custom wizard control defines the OnSideBarButtonClick method // that uses the AllowNavigationToStep method to determine whether the // value passed in can be used to set the ActiveStepIndex property. class CustomWizard : Wizard { override protected void OnSideBarButtonClick(WizardNavigationEventArgs e) { base.OnSideBarButtonClick(e); if (AllowNavigationToStep(e.NextStepIndex)) { this.Page.Response.Write("AllowNavigationToStep() returned true, moving to Step" + (e.NextStepIndex + 1).ToString() + "."); this.ActiveStepIndex = e.NextStepIndex; } else { this.Page.Response.Write("AllowNavigationToStep() returned false for Step" + (e.NextStepIndex + 1).ToString() + ", moving to Step2."); this.ActiveStepIndex = 1; } } } // Add the custom wizard control to the page. void Page_Load(object sender, EventArgs e) { CustomWizard WizardControl = new CustomWizard(); WizardControl.ID = "WizardControl"; // Create some steps for the custom wizard. for (int i = 0; i <= 5; i++) { WizardStep newStep = new WizardStep(); newStep.ID = "Step" + (i + 1).ToString(); // Set AllowReturn to false for some of the steps. if ((i % 2) == 0) { newStep.AllowReturn = false; } // Add each step to the custom wizard. WizardControl.WizardSteps.Add(newStep); } // Display the wizard on the page. PlaceHolder1.Controls.Add(WizardControl); } </script> <html> <body> <form id="Form1" runat="server"> <h3>AllowNavigationToStep 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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からWizard.AllowNavigationToStep メソッドを検索する場合は、下記のリンクをクリックしてください。

- Wizard.AllowNavigationToStep メソッドのページへのリンク