RepeaterItemCollection.Item[Int32] 屬性

定義

取得集合中位於指定索引的 RepeaterItem 物件。

public:
 property System::Web::UI::WebControls::RepeaterItem ^ default[int] { System::Web::UI::WebControls::RepeaterItem ^ get(int index); };
public System.Web.UI.WebControls.RepeaterItem this[int index] { get; }
member this.Item(int) : System.Web.UI.WebControls.RepeaterItem
Default Public ReadOnly Property Item(index As Integer) As RepeaterItem

參數

index
Int32

要在集合中擷取的 RepeaterItem 之以零起始的索引。

屬性值

集合中位於指定索引的 RepeaterItem 物件。

範例

若要在完整範例的內容中查看此程式碼,請參閱 RepeaterItemCollection 類別主題。

      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 />";
      }
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

備註

使用此索引子,即可使用陣列標記法,從 RepeaterItemCollection 位於指定索引處的 取得 RepeaterItem 物件。

適用於

另請參閱