RepeaterItemCollection.Count Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém o número de RepeaterItem objetos na coleção.
public:
property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer
Valor de Propriedade
O número de DataListItem objetos na coleção.
Implementações
Exemplos
Para ver este código no contexto de um exemplo completo, veja o RepeaterItemCollection tópico da aula.
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
Observações
Use a Count propriedade para determinar o número de RepeaterItem objetos na RepeaterItemCollection coleção. A Count propriedade é frequentemente usada ao iterar pela coleção para determinar o limite superior da mesma.