Share via


VisibleItemCount Property

Returns the number of items that are visible on the current ASP.NET mobile Web Forms page.

public int VisibleItemCount {
   get
}

Remarks

If the control is not visible at all on the current form page, this value is 0.

Example

The following example demonstrates how to use the VisibleItemCount property to display the number of items on the current page.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Not IsPostBack Then
   Form1.Paginate = True
   List1.ItemsPerPage = 20
   Dim i As Integer
   For i = 0 To 99
      List1.Items.Add(("List1 Item" + i.ToString()))
   Next i
End If
Label1.Text = "Items per Page is " + List1.ItemsPerPage.ToString() + " And and VisibleCount is " + List1.VisibleItemCount.ToString()
End Sub

[C#]

public void Page_Load(Object sender, EventArgs e)
{
   if (!IsPostBack)
   {  
      Form1.Paginate = true;
      List1.ItemsPerPage = 20;
      for (int i = 0; i < 100; i++)
      {
         List1.Items.Add("List1 Item" + i);
      }
   }
   Label1.Text = "Items per Page is " + List1.ItemsPerPage 
     + " and VisibleCount is " + List1.VisibleItemCount;
}  

See Also

Applies to: PagedControl Class