This documentation is archived and is not being maintained.

Form.PageCount Property

Returns the number of pages in the form after the form is paginated. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the Web site.

Namespace:  System.Web.UI.MobileControls
Assembly:  System.Web.Mobile (in System.Web.Mobile.dll)

public int PageCount { get; }

Property Value

Type: System.Int32
The number of pages in the form after the form is paginated.

The Form control exposes the PageCount property and the CurrentPage property, which provide information about how the current form is paginated. The PageCount property also helps provide navigation capability to another page. For example, when rendering on a richer device, a search results form might include device-specific UI elements that allow the user to browse to a page of results by number rather than by link navigation.


This value is available after the Paginated event has occurred. To get the PageCount property, you can handle the Paginated event of the form.

The following code example demonstrates how to use the PageCount property of the Form control. This code example is part of a larger example for the ControlToPaginate property.

void Form_Paginated(object sender, EventArgs e)
    // Set the background color based on 
    // the number of pages
    if (ActiveForm.PageCount > 1)
        ActiveForm.BackColor = Color.LightBlue;
        ActiveForm.BackColor = Color.LightGray;

    // Check to see if the Footer template has been chosen
    if (DevSpec.HasTemplates)
        System.Web.UI.MobileControls.Label lbl = null;

        // Get the Footer panel
        System.Web.UI.MobileControls.Panel pan = Form1.Footer;

        // Get the Label from the panel
        lbl = (System.Web.UI.MobileControls.Label)pan.FindControl("lblCount");
        // Set the text in the Label
        lbl.Text = "Page #" + Form1.CurrentPage.ToString();

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.