This documentation is archived and is not being maintained.

RepeaterItemCollection.Item Property

Gets the RepeaterItem object at the specified index in the collection.

[C#] In C#, this property is the indexer for the RepeaterItemCollection class.

[Visual Basic]
Public Default ReadOnly Property Item( _
   ByVal index As Integer _
) As RepeaterItem
[C#]
public RepeaterItem this[
 int index
] {get;}
[C++]
public: __property RepeaterItem* get_Item(
 int index
);
[JScript]
returnValue = RepeaterItemCollectionObject.Item(index);
-or-
returnValue = RepeaterItemCollectionObject(index);

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.

Arguments [JScript]

index
The zero-based index of the RepeaterItem object to retrieve in the collection.

Parameters [Visual Basic, C#, C++]

index
The zero-based index of the RepeaterItem object to retrieve in the collection.

Property Value

A RepeaterItem object at the specified index in the collection.

Remarks

Use this indexer to get a RepeaterItem object from the RepeaterItemCollection at the specified index, using array notation.

Example

[Visual Basic] 
<!-- 
To see this snippet in the context of a complete example,
see the RepeaterItemCollection class topic.
-->
    . . . 
         Sub Item_Clicked(Sender As [Object], e As EventArgs)
            labelDisplay.Text = "Using item indexer.<br>"
            labelDisplay.Text += "The Items collection contains: <br>"
            
            ' Display the elements of the RepeaterItemCollection using the indexer.
            Dim myItemCollection As RepeaterItemCollection = myRepeater.Items
            Dim index As Integer
            For index = 0 To myItemCollection.Count - 1
               labelDisplay.Text += CType(myItemCollection(index).Controls(0), DataBoundLiteralControl).Text + "<br>"
            Next index
         End Sub 'Item_Clicked


[C#] 
<!-- 
To see this snippet in the context of a complete example,
see the RepeaterItemCollection class topic.
-->
    . . . 
      void Item_Clicked(Object Sender, EventArgs e)
      {
         labelDisplay.Text = "Using item indexer.<br>";
         labelDisplay.Text += "The Items collection contains: <br>";

         // Display the elements of the RepeaterItemCollection using the indexer.
         RepeaterItemCollection  myItemCollection = myRepeater.Items;
         for(int index=0;index < myItemCollection.Count;index++)
         labelDisplay.Text += ((DataBoundLiteralControl)
            myItemCollection[index].Controls[0]).Text + "<br>";
      }

[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 | RepeaterItem

Show: