Redigeeri

Jagamisviis:


WizardStepCollection Class

Definition

Represents a collection of WizardStepBase-derived objects in a control that acts as a wizard. This class cannot be inherited.

public ref class WizardStepCollection sealed : System::Collections::IList
public sealed class WizardStepCollection : System.Collections.IList
type WizardStepCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public NotInheritable Class WizardStepCollection
Implements IList
Inheritance
WizardStepCollection
Implements

Examples

The following example demonstrates how to populate the WizardStepCollection collection using declarative syntax.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<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" >
        <WizardSteps>
          <asp:WizardStep id="Step1" 
            runat="server" 
            title="Step 1">
          </asp:WizardStep>
          <asp:WizardStep id="Step2" 
            runat="server" 
            title="Step 2">
          </asp:WizardStep>
          <asp:WizardStep id="Step3" 
            runat="server" 
            title="Step 3">
          </asp:WizardStep>
          <asp:WizardStep id="Step4" 
            runat="server" 
            title="Step 4">
          </asp:WizardStep>
          <asp:WizardStep id="Step5" 
            runat="server" 
            title="Step 5">
          </asp:WizardStep>
          <asp:WizardStep id="Step6" 
            runat="server" 
            title="Step 6">
          </asp:WizardStep>
        </WizardSteps>
        <HeaderTemplate>
          <b>WizardStepCollection 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">

<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" >
        <WizardSteps>
          <asp:WizardStep id="Step1" 
            runat="server" 
            title="Step 1">
          </asp:WizardStep>
          <asp:WizardStep id="Step2" 
            runat="server" 
            title="Step 2">
          </asp:WizardStep>
          <asp:WizardStep id="Step3" 
            runat="server" 
            title="Step 3">
          </asp:WizardStep>
          <asp:WizardStep id="Step4" 
            runat="server" 
            title="Step 4">
          </asp:WizardStep>
          <asp:WizardStep id="Step5" 
            runat="server" 
            title="Step 5">
          </asp:WizardStep>
          <asp:WizardStep id="Step6" 
            runat="server" 
            title="Step 6">
          </asp:WizardStep>
        </WizardSteps>
        <HeaderTemplate>
          <b>WizardStepCollection Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </form>
  </body>
</html>

The following example demonstrates how to programmatically populate a WizardStepCollection collection.

<%@ Page Language="C#" CodeFile="WizardStepCollection.cs" Inherits="WizardStepCollectioncs_aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardStepCollection Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardStepCollection Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </form>
  </body>
</html>
<%@ Page Language="VB" CodeFile="WizardStepCollection.vb" Inherits="WizardStepCollectionvb_aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

The following is the code-behind file for the Web page in the preceding example.

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 WizardStepCollectioncs_aspx : System.Web.UI.Page
{ 

    void Page_Load(object sender, EventArgs e)
    {
        // Programmatically create a wizard control.
        Wizard Wizard1 = new Wizard();

        // Create steps for the wizard control and insert them
        // into the WizardStepCollection collection.
        for (int i = 0; i <= 5; i++)
        {
            WizardStepBase newStep = new WizardStep();
            newStep.ID = "Step" + (i + 1).ToString();
            newStep.Title = "Step " + (i + 1).ToString();
            Wizard1.WizardSteps.Add(newStep);
        }

        // Display the wizard control on the Web page.
        PlaceHolder1.Controls.Add(Wizard1);
    }
}
Partial Class WizardStepCollectionvb_aspx
    Inherits System.Web.UI.Page

    Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        ' Programmatically create a wizard control.
        Dim Wizard1 As Wizard = New Wizard()

        ' Create steps for the wizard control and insert them
        ' into the WizardStepCollection collection.
        For i As Integer = 0 To 5
            Dim newStep As WizardStepBase = New WizardStep()
            newStep.ID = "Step" + (i + 1).ToString()
            newStep.Title = "Step " + (i + 1).ToString()
            Wizard1.WizardSteps.Add(newStep)
        Next

        ' Display the wizard control on the Web page.
        PlaceHolder1.Controls.Add(Wizard1)

    End Sub

End Class

Remarks

The WizardStepCollection class is used to store and manage a collection of WizardStepBase-derived objects in a control that acts as a wizard, such as the CreateUserWizard control or the Wizard control. For example, the Wizard control uses the WizardStepCollection class for its WizardSteps property.

There are multiple ways you can access the WizardStepBase-derived objects in the WizardStepCollection:

Properties

Count

Gets the number of WizardStepBase-derived objects in the Wizard control's WizardStepCollection collection.

IsReadOnly

Gets a value indicating whether the WizardStepBase-derived objects in the collection can be modified.

IsSynchronized

Gets a value indicating whether access to the collection is synchronized (thread-safe).

Item[Int32]

Gets a WizardStepBase-derived object from the collection at the specified index.

SyncRoot

Gets an object that can be used to synchronize access to the collection.

Methods

Add(WizardStepBase)

Appends the specified WizardStepBase-derived object to the end of the collection.

AddAt(Int32, WizardStepBase)

Adds the specified WizardStepBase-derived object to the collection at the specified index location.

Clear()

Removes all WizardStepBase-derived objects from the collection.

Contains(WizardStepBase)

Determines whether the WizardStepCollection collection contains a specific WizardStepBase-derived object.

CopyTo(WizardStepBase[], Int32)

Copies all the items from a WizardStepCollection collection to a compatible one-dimensional array of WizardStepBase objects, starting at the specified index in the target array.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Returns an IEnumerator-implemented object that can be used to iterate through the WizardStepBase-derived objects in the collection.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
IndexOf(WizardStepBase)

Determines the index value that represents the position of the specified WizardStepBase-derived object in the collection.

Insert(Int32, WizardStepBase)

Inserts the specified WizardStepBase-derived object into the collection at the specified index location.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(WizardStepBase)

Removes the specified WizardStepBase-derived object from the collection.

RemoveAt(Int32)

Removes the WizardStepBase-derived object from the collection at the specified location.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

Copies all the items from a WizardStepCollection collection to a one-dimensional array, starting at the specified index in the target array.

IList.Add(Object)

Appends the specified object to the end of the collection.

IList.Contains(Object)

Determines whether the collection contains the specified object.

IList.IndexOf(Object)

Determines the index value that represents the position of the specified object in the collection.

IList.Insert(Int32, Object)

Inserts the specified object in the collection at the specified position.

IList.IsFixedSize

Gets a value indicating whether the collection has a fixed size.

IList.Item[Int32]

Gets the object at the specified index in the collection.

IList.Remove(Object)

Removes the specified object from the collection.

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See also