This documentation is archived and is not being maintained.

RepeaterItemCollection Constructor

Initializes a new instance of the RepeaterItemCollection class.

[Visual Basic]
Public Sub New( _
   ByVal items As ArrayList _
)
[C#]
public RepeaterItemCollection(
   ArrayList items
);
[C++]
public: RepeaterItemCollection(
   ArrayList* items
);
[JScript]
public function RepeaterItemCollection(
   items : ArrayList
);

Parameters

items
A System.Collections.ArrayList object that contains the items with which to initialize the collection.

Remarks

Use this constructor to create and initialize a new instance of the RepeaterItemCollection class.

Example

[Visual Basic] 
Sub Page_Load(Sender As Object, e As EventArgs)
   If Not IsPostBack Then
      Dim myDataSource As New ArrayList()

      myDataSource.Add(New PositionData("Item 1", "$6.00"))
      myDataSource.Add(New PositionData("Item 2", "$7.48"))
      myDataSource.Add(New PositionData("Item 3", "$9.96"))

      ' Initialize the RepeaterItemCollection using the ArrayList as the data source.
      Dim myCollection As New RepeaterItemCollection(myDataSource)
      myRepeater.DataSource = myCollection
      myRepeater.DataBind()
   End If
End Sub 'Page_Load

[C#] 
void Page_Load(Object Sender, EventArgs e)
{
   if (!IsPostBack)
   {
      ArrayList myDataSource = new ArrayList();

      myDataSource.Add(new PositionData("Item 1", "$6.00"));
      myDataSource.Add(new PositionData("Item 2", "$7.48"));
      myDataSource.Add(new PositionData("Item 3", "$9.96"));
      
      // Initialize the RepeaterItemCollection using the ArrayList as the data source.
      RepeaterItemCollection myCollection = new RepeaterItemCollection(myDataSource);
      myRepeater.DataSource = myCollection;
      myRepeater.DataBind();
   }
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

RepeaterItemCollection Class | RepeaterItemCollection Members | System.Web.UI.WebControls Namespace | System.Collections.ArrayList

Show: