This documentation is archived and is not being maintained.

DataPagerField Class

Serves as the base class for data pager field types, which represent a navigation control for the DataPager control.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public abstract class DataPagerField : IStateManager

The DataPagerField class serves as the base class for all data pager field types. Data pager fields are used by the DataPager control to represent a navigation control.

Use the classes that are derived from DataPagerField to select which type of pager is displayed in the DataPager control. The following table lists available data pager field types.

Pager field type



Lets users navigate through data pages one page at a time, or to jump to the first or last page.


Lets users select a page by page number.


Lets page developers create a custom paging UI.

You can derive from the DataPagerField class to create additional pager field types.

Notes to Inheritors:

When you inherit from the DataPagerField class, you must override the following members:

The following example shows how to use NextPreviousPagerField, NumericPagerField, and TemplatePagerField objects to display page navigation controls in a DataPager control. The objects are derived from the DataPagerField class.

<%@ Page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

<html xmlns="" >
  <head id="Head1" runat="server">
    <title>DataPagerField Example</title>    
    <style type="text/css">
      	text-align: center; 
      	font: 13px Tahoma, Arial, Helvetica;
        border-bottom: solid 1px #FFA500;
    <form id="form1" runat="server">

      <h3>DataPagerField Example</h3>

      <asp:ListView ID="ProductsListView" 
          <table runat="server" id="tblProducts" width="350">
            <tr runat="server" id="itemPlaceholder" />
          <tr runat="server">
            <td class="item">
              <asp:Label ID="NameLabel" runat="server" 
                Text='<%#Eval("Name") %>' />
          <tr runat="server">
              <asp:Label ID="DescriptionLabel" runat="server" 
                Text='<%#Eval("Description")%>' />
          <tr runat="server">
      <br />

      <asp:DataPager runat="server" 
            <asp:Label runat="server" ID="CurrentPageLabel" 
              Text="<%# Container.TotalRowCount>0 ? (Container.StartRowIndex / Container.PageSize) + 1 : 0 %>" />
            <asp:Label runat="server" ID="TotalPagesLabel" 
              Text="<%# Math.Ceiling ((double)Container.TotalRowCount / Container.PageSize) %>" />
            <br /><br />

            ShowPreviousPageButton="false" />

            ButtonCount="10" />

            ShowPreviousPageButton="false" />

      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->
      <asp:SqlDataSource ID="ContactsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
        SelectCommand="SELECT P.Name, PD.Description 
                      FROM Production.ProductModel AS PM 
                      INNER JOIN Production.Product AS P ON PM.ProductModelID = P.ProductModelID 
                      INNER JOIN Production.ProductModelProductDescriptionCulture AS PMPDC 
                      ON PM.ProductModelID = PMPDC.ProductModelID 
                      INNER JOIN Production.ProductDescription AS PD 
                      ON PMPDC.ProductDescriptionID = PD.ProductDescriptionID 
                      WHERE (PMPDC.CultureID = 'en')">


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5