NumericPagerField.ButtonType Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the button type to display in the pager field.

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

public ButtonType ButtonType { get; set; }

Property Value

Type: System.Web.UI.WebControls.ButtonType

One of the ButtonType values. The default is ButtonType.Link.

Exception Condition

The value for the ButtonType property is not one of the ButtonType values.

The following table lists the available button types.

Button type value



A Button control.


An ImageButton control.


A LinkButton control.

When the ButtonType property is set to ButtonType.Image, you must provide the URL of an image for the next-page and previous page buttons. To do this, you can use the NextPageImageUrl and PreviousPageImageUrl properties. The corresponding text property is used as the alternate text for the image. For example, the text that is specified by the NextPageImageUrl property is displayed as the alternate text for the next-page image button. On browsers that support tooltips, this text is also displayed as a tooltip for the corresponding button.

The value of the ButtonType property is stored in view state.

If the DataPager.QueryStringField property is not an empty string or null, the NumericPagerField object ignores the value of the ButtonCount property. In that case, the HyperLink control is used to create the buttons.

The following example shows how to use the ButtonType property to specify that image buttons are displayed in the NumericPagerField object of a DataPager control.

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

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

<html xmlns="" >
  <head id="Head1" runat="server">
    <title>NumericPagerField Example</title>
    <style type="text/css">
        .header { background-color:#8FBC8F; }
        table { border: solid 1px #000000; } 
    <form id="form1" runat="server">

      <h3>NumericPagerField Example</h3>

      <asp:ListView ID="VendorsListView" 
          <table cellpadding="2" width="640px" runat="server" id="tblVendor">
            <tr align="center" class="header" runat="server">
              <td runat="server">ID</td>
              <td runat="server">Vendor Name</td>
              <td runat="server">Active</td>
            <tr id="itemPlaceholder" runat="server">
          <tr runat="server">
              <asp:Label ID="VendorIDLabel" runat="server" Text='<%#Eval("VendorID") %>' />
              <asp:Label ID="NameLabel" runat="server" Text='<%#Eval("Name") %>' />
            <td align="center">
              <asp:CheckBox ID="ActiveFlagCheck" runat="server" 
                Checked='<%#Eval("ActiveFlag") %>' 
                Enabled="false" />

      <asp:DataPager runat="server" ID="ContactsDataPager" 
            ButtonType="Image" />

      <!-- 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="VendorsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
        SelectCommand="SELECT [VendorID], [Name], [ActiveFlag] FROM Purchasing.Vendor">


.NET Framework
Available since 3.5
Return to top