WizardStepCollection.Add(WizardStepBase) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 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 -derived WizardStep 개체를 컬렉션에 WizardSteps 추가하는 WizardStepBase방법을 보여 줍니다. 예제 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 -derived 개체를 컬렉션의 끝에 추가 WizardStepBase합니다 WizardStepCollection . 특정 인덱스 위치의 WizardStepBase컬렉션에 파생 개체를 추가하려면 메서드를 AddAt 사용합니다.