Wizard クラスとは? わかりやすく解説

Wizard クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

複数ステップわたって関連データ収集するためのナビゲーションおよびユーザー インターフェイス (UI) を提供します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説

Wizard コントロール使用すると、以下の処理を実行できます

Wizard コントロールは、次のコンポーネント構成されます。

Wizard コントロール内のステップには、ステップナビゲーション機能種類決定する StepType プロパティありますStepType プロパティに値を指定しなかった場合既定値AutoなりますStepType プロパティ指定できる設定と、各設定でのステップ動作次の表に示します

WizardStepType.Auto

あるステップ表示されるナビゲーション UI は、そのステップ宣言されている順序によって決定されます。

WizardStepType.Complete

最後に表示されるステップです。ナビゲーション ボタン表示されません。

WizardStepType.Finish

ユーザー データ収集する最後ステップです。ナビゲーション用に [完了] ボタン表示されます。

WizardStepType.Start

最初に表示されるステップです。[戻る] ボタン表示されません。

WizardStepType.Step

最初のステップ最後ステップの間のステップです。ナビゲーション用に [戻る] ボタンと [次へ] ボタン表示されます。

Wizard コントロール使用すると、直線的または非直線的なナビゲーションによってデータ収集できます。非直線的なナビゲーションの例としては、不要なステップスキップや、以前完了したステップ戻っての値の変更などがありますWizard コントロールステップ間の状態を保持するため、Wizard コントロールすべてのステップ完了するまでは、ステップ入力されデータデータ ストア永続化する必要はありません。

NextButtonClick イベント発生したときなど、各ステップ完了時に収集済みデータデータ ストア永続化する場合は、WizardStepBase オブジェクトの AllowReturn プロパティfalse設定してデータ送信された後は、ユーザー以前完了したステップ戻ってデータ変更できないようにする必要があります

MoveTo メソッドまたは ActiveStepIndex プロパティ使用すると、Wizard コントロールに現在表示されているステップ動的に変更できます

メモメモ

プログラムによって Page_Load イベント ハンドラに WizardStep を追加する場合は、ページ読み込み前にその手順へナビゲーション追加する必要があります

Wizard コントロール外観は、テンプレートスキン、およびスタイル設定によって完全にカスタマイズできます。たとえば、HeaderTemplate、SideBarTemplate、StartNavigationTemplate、FinishNavigationTemplate、および StepNavigationTemplate の各プロパティ使用してWizard コントロールインターフェイスカスタマイズできます

メモメモ

FinishNavigationTemplate、DisplaySideBar、HeaderTemplateSideBarTemplateStartNavigationTemplate、または StepNavigationTemplate の各プロパティ設定すると、Wizard コントロールの子コントロール再作成されますその結果、子コントロールビューステートが処理中に失われます。この状況回避するには、Wizard コントロールの子コントロールの状態明示的に保持するか、コントロールテンプレート内部入れないようにします。

Wizard コントロールは、非標準モードまたは互換捻出モードにおける Microsoft Internet Explorer での特別なレンダリングサポートしていません。Wizard コントロール使用して Internet Explorer での最適なレンダリング実現するには、既定Visual Web Developer および Visual Studio追加されている XHTML ドキュメント タイプ使用します

ユーザー補助

使用例使用例

Wizard コントロール定義し個別送付先入力するオプション付きで、ユーザーの名前と住所収集する方法次のコード例示しますユーザーが [SeparateShippingCheckBox] を選択しなかった場合個別送付先追加する要求発行されWizard コントロールStep2 から Finish直接移動しますFinish ステップでは、[GoBackButton] をクリックして Wizard コントロール先頭に戻るためのオプションあります。ただし、Step1AllowReturn プロパティfalse設定されているため、ユーザーStep2戻ります

<%@ Page Language="VB" AutoEventWireup="false"
 CodeFile="WizardClass.vb" Inherits="WizardClassvb_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">
    
      <asp:Wizard id="Wizard1" 
        runat="server" 
        onfinishbuttonclick="OnFinishButtonClick"
 
        backcolor="#EFF3FB" 
        font-names="Verdana" 
        font-size="0.8em"
        borderwidth="1px" 
        bordercolor="#B5C7DE" 
        style="font-size: medium; font-family: Verdana;"
 
        onactivestepchanged="OnActiveStepChanged">
       
      <StepStyle forecolor="#333333" 
        font-size="0.8em" />
        <WizardSteps>        
          <asp:WizardStep id="Step1" 
            title="One"
            allowreturn="false" 
            runat="server" >
            Welcome to the Wizard example.  This step's
 AllowReturn property is set 
            to false, so after you leave this
 step you will not be able to
 return to it.
          </asp:WizardStep>          
          <asp:WizardStep id="Step2"
            title="Two" 
            runat="server" >
            <!-- ... Put UI elements here ... -->
            Please enter your billing information.
            <br />
            Name:<br />
            <asp:TextBox runat="server" 
              id="BillingName" 
              width="226px" 
              height="17px" /> 
            <br />
            Email Address:<br />
            <asp:TextBox runat="server" 
              id="EmailAddress" 
              width="224px" 
              height="17px" />
            <br />
            Address Line 1: <br />
            <asp:TextBox runat="server" 
              id="BillingAddressLine1" 
              width="314px" 
              height="17px" />
            <br />
            Address Line 2: <br />
            <asp:TextBox runat="server" 
              id="BillingAddressLine2" 
              width="314px" 
              height="17px" />
            <br />
            City: <br />
            <asp:TextBox runat="server" 
              id="BillingCity" 
              width="155px" 
              height="17px" /> 
            <br />
            State: <br />
            <asp:TextBox runat="server" 
              id="BillingState" 
              width="75px" 
              height="17px" /> 
            <br />
            ZIP Code: <br />
            <asp:TextBox runat="server" 
              id="BillingZip" 
              height="17px" />
            <br /><br />
            <asp:CheckBox runat="server" 
              id="SeparateShippingCheckBox" 
              text="Please check here if you would like to add
 a separate shipping address." />
          </asp:WizardStep>          
          <asp:WizardStep id="Step3" 
            title="Three"
            runat="server" >
            <!-- Gather the shipping address in this step
 if CheckBox1 was selected. -->
            Please enter your shipping information.
            <br />
                Name:<br />
                <asp:TextBox runat="server" 
                  id="ShippingName" 
                  height="17px" /> 
                <br />
                Address Line 1: <br />
                <asp:TextBox runat="server" 
                  id="ShippingAddress1" 
                  width="370px" 
                  height="17px" />
                <br />
                Address Line 2: <br />
                <asp:TextBox runat="server" 
                  id="ShippingAddress2" 
                  width="370px" 
                  height="17px" />
                <br />
                City: <br />
                <asp:TextBox runat="server" 
                  id="ShippingCity" 
                  height="17px" /> 
                <br />
                State: <br />
                <asp:TextBox runat="server" 
                  id="ShippingState" 
                  width="65px" 
                  height="17px" />
                <br /> 
                ZIP Code: <br />
                <asp:TextBox runat="server" 
                  id="ShippingZip" 
                  height="17px" />
          </asp:WizardStep>
          <asp:WizardStep id="Finish" 
            title="Finish"
            runat="server" >
            <!-- Put UI elements here for the Finish step.
 -->
            <asp:Button runat="server" 
              id="GoBackButton" 
              text="Go Back to Step 2" 
              forecolor="#284E98" 
              font-names="Verdana"
              font-size="1.0em" 
              borderstyle="Solid" 
              borderwidth="1px" 
              bordercolor="#507CD1" 
              backcolor="White" /> 
          </asp:WizardStep>          
          <asp:WizardStep runat="server" 
            steptype="Complete" 
            title="Complete" 
            id="Complete">
            <asp:Label runat="server" 
              id="CompleteMessageLabel" 
              width="408px" 
              height="24px">
            </asp:Label>
          </asp:WizardStep>
        </WizardSteps> 
        <NavigationButtonStyle forecolor="#284E98"
 
          font-names="Verdana"
          font-size="1.0em" 
          borderstyle="Solid" 
          borderwidth="1px" 
          bordercolor="#507CD1" 
          backcolor="White" />
        <HeaderStyle forecolor="White" 
          horizontalalign="Center" 
          font-size="0.9em" 
          font-bold="True"
          backcolor="#284E98" 
          borderstyle="Solid" 
          bordercolor="#EFF3FB" 
          borderwidth="2px" />
        <SideBarStyle verticalalign="Top" 
          horizontalalign="Center"
          font-size="0.8em" 
          forecolor="#000099"
          backcolor="#EFF3FB"
          width="45px" />
        <HeaderTemplate>
          <b>Wizard Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </form>
  </body>
</html>
<%@ Page Language="C#" CodeFile="WizardClass.cs" Inherits="WizardClasscs_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">    
      <asp:Wizard id="Wizard1" 
        runat="server" 
        onfinishbuttonclick="OnFinishButtonClick" 
        backcolor="#EFF3FB" 
        font-names="Verdana" 
        font-size="0.8em"
        borderwidth="1px" 
        bordercolor="#B5C7DE" 
        style="font-size: medium; font-family: Verdana;" 
        onactivestepchanged="OnActiveStepChanged">       
      <StepStyle forecolor="#333333" 
        font-size="0.8em" />
        <WizardSteps>        
          <asp:WizardStep id="Step1" 
            title="One"
            allowreturn="false" 
            runat="server" >
            Welcome to the Wizard example.  This step's AllowReturn property is set
 
            to false, so after you leave this
 step you will not be able to return to it.
          </asp:WizardStep>          
          <asp:WizardStep id="Step2"
            title="Two" 
            runat="server" >
            <!-- ... Put UI elements here ... -->
            Please enter your billing information.
            <br />
            Name:<br />
            <asp:TextBox runat="server" 
              id="BillingName" 
              width="226px" 
              height="17px" /> 
            <br />
            E-mail Address:<br />
            <asp:TextBox runat="server" 
              id="EmailAddress" 
              width="224px" 
              height="17px" />
            <br />
            Address Line 1: <br />
            <asp:TextBox runat="server" 
              id="BillingAddressLine1" 
              width="314px" 
              height="17px" />
            <br />
            Address Line 2: <br />
            <asp:TextBox runat="server" 
              id="BillingAddressLine2" 
              width="314px" 
              height="17px" />
            <br />
            City: <br />
            <asp:TextBox runat="server" 
              id="BillingCity" 
              width="155px" 
              height="17px" /> 
            <br />
            State: <br />
            <asp:TextBox runat="server" 
              id="BillingState" 
              width="75px" 
              height="17px" /> 
            <br />
            ZIP Code: <br />
            <asp:TextBox runat="server" 
              id="BillingZip" 
              height="17px" />
            <br /><br />
            <asp:CheckBox runat="server" 
              id="SeparateShippingCheckBox" 
              text="Please check here if you would like to
 add a separate shipping address." />
          </asp:WizardStep>          
          <asp:WizardStep id="Step3" 
            title="Three" 
            runat="server" >
            <!-- Gather the shipping address in this
 step if CheckBox1 was selected. -->
            Please enter your shipping information.
            <br />
                Name:<br />
                <asp:TextBox runat="server" 
                  id="ShippingName" 
                  height="17px" /> 
                <br />
                Address Line 1: <br />
                <asp:TextBox runat="server" 
                  id="ShippingAddress1" 
                  width="370px" 
                  height="17px" />
                <br />
                Address Line 2: <br />
                <asp:TextBox runat="server" 
                  id="ShippingAddress2" 
                  width="370px" 
                  height="17px" />
                <br />
                City: <br />
                <asp:TextBox runat="server" 
                  id="ShippingCity" 
                  height="17px" /> 
                <br />
                State: <br />
                <asp:TextBox runat="server" 
                  id="ShippingState" 
                  width="65px" 
                  height="17px" />
                <br /> 
                ZIP Code: <br />
                <asp:TextBox runat="server" 
                  id="ShippingZip" 
                  height="17px" />
          </asp:WizardStep>
          <asp:WizardStep id="Finish" 
            title="Finish"
            runat="server" >
            <!-- Put UI elements here for the Finish step.
 -->
            <asp:Button runat="server" 
              id="GoBackButton" 
              text="Go Back to Step 2" 
              onclick="OnGoBackButtonClick"
              forecolor="#284E98" 
              font-names="Verdana"
              font-size="1.0em" 
              borderstyle="Solid" 
              borderwidth="1px" 
              bordercolor="#507CD1" 
              backcolor="White" /> 
          </asp:WizardStep>          
          <asp:WizardStep runat="server" 
            steptype="Complete" 
            title="Complete" 
            id="Complete">
            <asp:Label runat="server" 
              id="CompleteMessageLabel" 
              width="408px" 
              height="24px">
            </asp:Label>
          </asp:WizardStep>
        </WizardSteps> 
        <NavigationButtonStyle forecolor="#284E98" 
          font-names="Verdana"
          font-size="1.0em" 
          borderstyle="Solid" 
          borderwidth="1px" 
          bordercolor="#507CD1" 
          backcolor="White" />
        <HeaderStyle forecolor="White" 
          horizontalalign="Center" 
          font-size="0.9em" 
          font-bold="True"
          backcolor="#284E98" 
          borderstyle="Solid" 
          bordercolor="#EFF3FB" 
          borderwidth="2px" />
        <SideBarStyle verticalalign="Top" 
          horizontalalign="Center"
          font-size="0.8em" 
          forecolor="#000099"
          backcolor="#EFF3FB"
          width="45px" />
        <HeaderTemplate>
          <b>Wizard Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </form>
  </body>
</html>

前の例で使用されWeb ページ対す分離コード ファイル次のコード例示します

Partial Class WizardClassvb_aspx
    Inherits System.Web.UI.Page

   Protected Sub OnFinishButtonClick(ByVal
 sender As Object, ByVal
 e As WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick

        ' The OnFinishButtonClick method is a good place to collect
 all
        ' the data from the completed pages and persist it to the data
 store. 

        ' For this example, write a confirmation message to the Complete
 page
        ' of the Wizard control.
        Dim tempLabel As Label = CType(Wizard1.FindControl("CompleteMessageLabel"),
 Label)
        If Not tempLabel Is
 Nothing Then

            Dim tempEmailAddress As String
 = "your e-mail address"
            If EmailAddress.Text.Length <> 0 Then
                tempEmailAddress = EmailAddress.Text
            End If

            tempLabel.Text = "Your order has been placed. An e-mail
 confirmation will be sent to " & _
                tempEmailAddress & "."

        End If
    End Sub

    Protected Sub OnGoBackButtonClick(ByVal
 sender As Object, ByVal
 e As EventArgs) Handles GoBackButton.Click

        ' The GoBackButtonClick event is raised when the GoBackButton
        ' is clicked on the Finish page of the Wizard.  

        ' Check the value of Step1's AllowReturn property.
        If Step1.AllowReturn Then
            ' Return to Step1.
            Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.Step1)
        Else
            ' Step1 is not a valid step to return to; go to Step2 instead.
            Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.Step2)
            Response.Write("ActiveStep is set to Step2 because
 Step1 has AllowReturn set to false.")
        End If
    End Sub

    Protected Sub OnActiveStepChanged(ByVal
 sender As Object, ByVal
 e As EventArgs) Handles Wizard1.ActiveStepChanged

        ' If the ActiveStep is changing to Step3, check to see whether
 the 
        ' SeparateShippingCheckBox is selected.  If it is not, skip
 to the
        ' Finish step.

        If (Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.Step3))
 Then

            If (Me.SeparateShippingCheckBox.Checked)
 Then
                Wizard1.MoveTo(Me.Step3)
            Else
                Wizard1.MoveTo(Me.Finish)
            End If

        End If
    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 WizardClasscs_aspx : System.Web.UI.Page
{
    protected void OnFinishButtonClick(Object
 sender, WizardNavigationEventArgs e)
    {
        // The OnFinishButtonClick method is a good place to collect
 all
        // the data from the completed pages and persist it to the data
 store. 

        // For this example, write a confirmation message to the Complete
 page
        // of the Wizard control.
        Label tempLabel = (Label)Wizard1.FindControl("CompleteMessageLabel");
        if (tempLabel != null)
        {
            tempLabel.Text = "Your order has been placed. An e-mail confirmation
 will be sent to "
            + (EmailAddress.Text.Length == 0 ? "your e-mail address" :
 EmailAddress.Text) + ".";
        }
    }

    protected void OnGoBackButtonClick(object
 sender, EventArgs e)
    {
        // The GoBackButtonClick event is raised when the GoBackButton
        // is clicked on the Finish page of the Wizard.  

        // Check the value of Step1's AllowReturn property.
        if (Step1.AllowReturn)
        {
            // Return to Step1.
            Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(this.Step1);
        }
        else
        {
            // Step1 is not a valid step to return to; go to Step2 instead.
            Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(this.Step2);
            Response.Write("ActiveStep is set to Step2 because
 Step1 has AllowReturn set to false.");
        }
    }

    protected void OnActiveStepChanged(object
 sender, EventArgs e)
    {
        // If the ActiveStep is changing to Step3, check to see whether
 the 
        // SeparateShippingCheckBox is selected.  If it is not, skip
 to the
        // Finish step.
        if (Wizard1.ActiveStepIndex == Wizard1.WizardSteps.IndexOf(this.Step3))
        {
            if (this.SeparateShippingCheckBox.Checked)
            {
                Wizard1.MoveTo(this.Step3);
            }
            else
            {
                Wizard1.MoveTo(this.Finish);
            }
        }
    }
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
       System.Web.UI.WebControls.CompositeControl
        System.Web.UI.WebControls.Wizard
           System.Web.UI.WebControls.CreateUserWizard
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Wizard クラス」の関連用語

Wizard クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Wizard クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS