WizardStepCollection.Add(WizardStepBase) 메서드

정의

지정된 WizardStepBase 파생 개체를 컬렉션의 끝에 추가합니다.

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

매개 변수

wizardStep
WizardStepBase

WizardStepBase 컬렉션에 추가할 WizardStepCollection 파생 개체입니다.

예외

전달된 WizardStepBase 파생 개체가 null인 경우

예제

다음 코드 예제에서는 프로그래밍 방식으로 작성 하는 방법을 보여 줍니다는 Wizard 제어 및 사용 하 여는 Add 추가 하는 방법 WizardStepBase-파생 WizardStep 개체를 WizardSteps 컬렉션입니다. 예제를 WizardSteps 의 속성을 Wizard 컨트롤의 인스턴스가 WizardStepCollection 클래스.

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

  // Programmatically create a Wizard control and dynamically
  // add WizardStep objects to it.    
  
  void Page_Load(object sender, EventArgs e) 
  {
    Wizard WizardControl = new Wizard();
      
    // Create some steps for the wizard and add them
    // to the Wizard control.
    for (int i = 0; i <= 5; i++)
    {
      WizardStepBase newStep = new WizardStep();
      newStep.ID = "Step" + (i + 1).ToString();
      WizardControl.WizardSteps.Add(newStep);
    }
    
    // Display the wizard on the page.
    PlaceHolder1.Controls.Add(WizardControl);
  }
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardSteps Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardSteps Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </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">
  
  ' Programmatically create a Wizard control and dynamically
  ' add WizardStep objects to it.    
  
  Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
      
    Dim WizardControl As New Wizard()
      
    ' Create some steps for the wizard and add them to 
    ' the Wizard control.
    For i As Integer = 0 To 5
      Dim newStep As WizardStepBase = New WizardStep()
      newStep.ID = "Step" + (i + 1).ToString()
      WizardControl.WizardSteps.Add(newStep)
    Next
    
    ' Display the wizard on the page.
    PlaceHolder1.Controls.Add(WizardControl)
        
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardSteps Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardSteps Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </form>
  </body>
</html>

설명

Add 메서드를 추가 합니다 WizardStepBase-파생 개체의 끝에는 WizardStepCollection 컬렉션입니다. 추가 하는 WizardStepBase-파생된 개체를 사용 하 여 특정 인덱스 위치의 컬렉션에는 AddAt 메서드.

적용 대상

추가 정보