RepeaterItemCollection.Count 속성

정의

컬렉션의 RepeaterItem 개체 수를 가져옵니다.

public:
 property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer

속성 값

컬렉션의 DataListItem 개체 수입니다.

구현

예제

전체 예제의 컨텍스트에서 이 코드를 보려면 클래스 항목을 참조 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

설명

Count 이 속성을 사용하여 컬렉션의 RepeaterItem 개체 수를 확인합니다RepeaterItemCollection. 이 Count 속성은 컬렉션의 상한을 결정하기 위해 컬렉션을 반복할 때 일반적으로 사용됩니다.

적용 대상

추가 정보