다음을 통해 공유


WizardStepBase.ID 속성

정의

서버 컨트롤에 할당된 프로그래밍 식별자를 가져오거나 설정합니다.

public:
 virtual property System::String ^ ID { System::String ^ get(); void set(System::String ^ value); };
public override string ID { get; set; }
member this.ID : string with get, set
Public Overrides Property ID As String

속성 값

컨트롤에 할당된 프로그래밍 방식 식별자입니다.

예외

디자인 타임에 속성이 잘못된 식별자 문자열로 설정되었습니다.

-또는-

이 속성은 디자인 타임에 포함하는 Wizard 컨트롤과 동일한 식별자로 설정되었습니다.

-또는-

이 속성은 디자인 타임에 포함하는 Wizard 컨트롤의 다른 단계와 동일한 식별자로 설정되었습니다.

예제

다음 코드 예제에서는 Web Forms 페이지에서 컨트롤에 대 한 Wizard 세 가지 마법사 단계를 정의 합니다. 페이지의 코드에서 마법사 단계 인스턴스의 이름은 ID 값으로 지정되며 코드WizardStep1WizardStep2WizardStep3에서 참조할 수 있습니다.

<%@ 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 if the 
    // CheckBox1 CheckBox is checked.  If it is then skip 
    // to the Step3 step.
    if (Wizard1.ActiveStep == this.WizardStep2)
    {
      if (this.CheckBox1.Checked)
      {
        Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(this.WizardStep3);
      }
    }
  }
  
</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="Check this checkbox 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>ActiveStepIndex 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 if the 
    ' CheckBox1 CheckBox is checked.  If it is then skip 
    ' to the Step3 step.
    If Wizard1.ActiveStep.Equals(Me.WizardStep2) Then
      If (Me.CheckBox1.Checked) Then
        Wizard1.ActiveStepIndex = Wizard1.WizardSteps.IndexOf(Me.WizardStep3)
      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="Check this checkbox 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>ActiveStepIndex Example</b>
          </HeaderTemplate>
        </asp:Wizard>
      </form>
  </body>
</html>

설명

ID 이 속성을 사용하여 Web Forms 페이지에서 특정 마법사 단계 컨트롤을 식별하고 참조합니다. 값은 ID 페이지에서 컨트롤 인스턴스의 이름이 됩니다. 이렇게 하면 해당 페이지에 대한 코드의 특정 단계에 쉽게 액세스할 수 있습니다. 예를 들어 컨트롤의 WizardStepBase 속성을 "Step1"로 설정 ID 하면 해당 페이지에 대한 코드에서 마법사 단계의 자식 컨트롤을 참조Step1.Controls할 수 있습니다.

컨트롤은 WizardStepBase 디자인 타임에 Wizard 단계가 추가되거나 수정될 때 컨트롤의 각 단계에 유효한 고유 식별자가 있는지 확인합니다. 예를 들어 디자인 타임에 단계를 설정할 ID 때 컨트롤에 포함된 Wizard 다른 단계의 식별자와 일치시킬 수 없으며 포함하는 Wizard 컨트롤의 식별자와 일치시킬 ID 수 없습니다.

적용 대상

추가 정보