Wizard.MoveTo(WizardStepBase) 메서드

정의

지정된 WizardStepBase 파생 개체를 ActiveStep 컨트롤의 Wizard 속성에 대한 값으로 설정합니다.

public:
 void MoveTo(System::Web::UI::WebControls::WizardStepBase ^ wizardStep);
public void MoveTo (System.Web.UI.WebControls.WizardStepBase wizardStep);
member this.MoveTo : System.Web.UI.WebControls.WizardStepBase -> unit
Public Sub MoveTo (wizardStep As WizardStepBase)

매개 변수

wizardStep
WizardStepBase

WizardStepBase으로 설정할 ActiveStep 파생 개체입니다.

예외

전달된 WizardStepBase 파생 개체의 값이 null인 경우

전달된 관련 ActiveStepIndex 파생 개체의 WizardStepBase가 -1인 경우

예제

다음 코드 예제에서는 컨트롤의 속성을 제어 하는 메서드를 ActiveStep 사용 MoveTo 하는 방법을 보여 줍니다Wizard. If the value of CheckBox1.Checked is true, the ActiveStep property is set to Wizard1.Step3; otherwise, the ActiveStep property is set to Wizard1.Step2.

<%@ 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">

  void OnActiveStepChanged(object sender, EventArgs e)
  {
    // If the ActiveStep is changing to Step2, check to see whether the 
    // CheckBox1 check box is selected.  If it is, skip to the Step3 step. 
    if (Wizard1.ActiveStepIndex == Wizard1.WizardSteps.IndexOf(this.WizardStep2))
    {
      if (this.CheckBox1.Checked)
      {
        Wizard1.MoveTo(this.WizardStep3);
      }
      else
      {
        Wizard1.MoveTo(this.WizardStep2);
      }
    }
  }
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <asp:Wizard id="Wizard1" 
        runat="server"
        onactivestepchanged="OnActiveStepChanged">
        <WizardSteps>
          <asp:WizardStep id="WizardStep1" 
            title="Step 1" 
            runat="server">
            <asp:CheckBox id="CheckBox1" 
              runat="Server" 
              text="Select this check box to skip Step 2." />
              You are currently on Step 1.
          </asp:WizardStep>
          <asp:WizardStep id="WizardStep2" 
            title="Step 2" 
            runat="server">
            You are currently on Step 2.
          </asp:WizardStep>
          <asp:WizardStep id="WizardStep3" 
            runat="server" 
            title="Step 3">
            You are currently on Step 3.
          </asp:WizardStep>
        </WizardSteps>
        <HeaderTemplate>
          <b>MoveTo Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </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">
  
  Sub OnActiveStepChanged(ByVal sender As Object, ByVal e As EventArgs)

    ' If the ActiveStep is changing to Step2, check to see whether the 
    ' CheckBox1 check box is selected.  If it is, skip to the Step3 step.
    If Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.WizardStep2) Then
    
      If (Me.CheckBox1.Checked) Then
        Wizard1.MoveTo(Me.WizardStep3)
      Else
        Wizard1.MoveTo(Me.WizardStep2)
      End If
    
    End If

  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <asp:Wizard id="Wizard1" 
        runat="server" 
        onactivestepchanged="OnActiveStepChanged">
        <WizardSteps>
          <asp:WizardStep id="WizardStep1" 
            title="Step 1" 
            runat="server">
            <asp:CheckBox id="CheckBox1" 
              runat="Server" 
              text="Select this check box to skip Step 2." />
              You are currently on Step 1.
          </asp:WizardStep>
          <asp:WizardStep id="WizardStep2" 
            title="Step 2" 
            runat="server">
            You are currently on Step 2.
          </asp:WizardStep>
          <asp:WizardStep id="WizardStep3" 
            runat="server" 
            title="Step 3">
            You are currently on Step 3.
          </asp:WizardStep>
        </WizardSteps>
        <HeaderTemplate>
          <b>MoveTo Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </form>
  </body>
</html>

설명

메서드를 MoveTo 사용하여 프로그래밍 방식으로 컨트롤 WizardStepBase의 속성 값 ActiveStep 으로 설정되는 파생 개체를 Wizard 제어할 수 있습니다. 이렇게 하면 런타임 동안 다른 조건에 따라 속성을 동적으로 변경할 ActiveStep 수 있습니다.

적용 대상

추가 정보