This documentation is archived and is not being maintained.

Form.ControlToPaginate Property

Gets or sets the control on the form that can be paginated. The default is null (Nothing in Visual Basic). 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 Control ControlToPaginate { get; set; }
<asp:Form ControlToPaginate="Control" />

Property Value

Type: System.Web.UI.Control
The control on the form that can be paginated.

The ControlToPaginate property is used to allow a single control on a form to paginate its contents across several views on mobile devices and providing next and previous navigation between views. A control can paginate its contents even if a containing Panel control has its Paginate property set to false.

The following code example demonstrates how to use the ControlToPaginate property of the Form class to specify which control to paginate.

The example creates a page with two forms. One form has a very long string that on some devices must be paginated to give the user access to the entire text. In order to see the pagination in action, you must view the example on a device that handles pagination. In Visual Studio 2005, you can use one of the device emulators available with the Device Emulator Manager on the Tools menu.


The following code example uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code example must be copied into an empty text file that has an .aspx extension. For more information, see ASP.NET Web Page Syntax Overview.

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Web.UI.MobileControls" %>
<%@ Import Namespace="System.Drawing" %>

<script Runat="server">
    void Form_Activate(object sender, EventArgs e)
        Form1.Wrapping = Wrapping.NoWrap;
        string a = "This is a very long string <br />";
        string b = "START ";

        // Create a long string to force pagination
        for (int i = 0; i < 100; i++)
            b += a;

        txtView.Text = b + " END";
        Form1.ControlToPaginate = txtView;

    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();

    void Page_Load(object sender, EventArgs e)
        // Set the pager text properties
        if (!IsPostBack)
            Form1.PagerStyle.NextPageText = "Go Next >";
            // For postback, set different text
            Form1.PagerStyle.NextPageText = "Go More >";
            Form1.PagerStyle.PreviousPageText = "< Go Prev";

<html xmlns="" >
<!-- The first Form -->
    <mobile:Form ID="Form1" Runat="server" 
        Paginate="true" OnActivate="Form_Activate" 
        <mobile:link ID="Link1" Runat="server" 
            Go To Other Form
        <mobile:Label ID="Label1" Runat="server">
            Welcome to ASP.NET
        <mobile:textview ID="txtView" Runat="server" />

        <mobile:DeviceSpecific ID="DevSpec" Runat="server">
                    <mobile:Label runat="server" id="lblCount" />

    <!-- The second Form -->
    <mobile:Form ID="Form2" Runat="server" 
        Paginate="true" OnPaginated="Form_Paginated">
        <mobile:Label ID="message2" Runat="server">
            Welcome to ASP.NET
        <mobile:link ID="Link2" Runat="server" 

.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.