PagerSettings Class
TOC
Collapse the table of content
Expand the table of content

PagerSettings Class

 

Represents the properties of the paging controls in a control that supports pagination. This class cannot be inherited.

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

System.Object
  System.Web.UI.WebControls.PagerSettings

[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public sealed class PagerSettings : IStateManager

NameDescription
System_CAPS_pubmethodPagerSettings()

Initializes a new instance of the PagerSettings class.

NameDescription
System_CAPS_pubpropertyFirstPageImageUrl

Gets or sets the URL to an image to display for the first-page button.

System_CAPS_pubpropertyFirstPageText

Gets or sets the text to display for the first-page button.

System_CAPS_pubpropertyLastPageImageUrl

Gets or sets the URL to an image to display for the last-page button.

System_CAPS_pubpropertyLastPageText

Gets or sets the text to display for the last-page button.

System_CAPS_pubpropertyMode

Gets or sets the mode in which to display the pager controls in a control that supports pagination.

System_CAPS_pubpropertyNextPageImageUrl

Gets or sets the URL to an image to display for the next-page button.

System_CAPS_pubpropertyNextPageText

Gets or sets the text to display for the next-page button.

System_CAPS_pubpropertyPageButtonCount

Gets or sets the number of page buttons to display in the pager when the Mode property is set to the Numeric or NumericFirstLast value.

System_CAPS_pubpropertyPosition

Gets or sets a value that specifies the location where the pager is displayed.

System_CAPS_pubpropertyPreviousPageImageUrl

Gets or sets the URL to an image to display for the previous-page button.

System_CAPS_pubpropertyPreviousPageText

Gets or sets the text to display for the previous page button.

System_CAPS_pubpropertyVisible

Gets or sets a value indicating whether the paging controls are displayed in a control that supports pagination.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Retrieves the string representation of a PagerSettings object.(Overrides Object.ToString().)

NameDescription
System_CAPS_pubeventPropertyChanged

Occurs when a property of a PagerSettings object changes values.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.LoadViewState(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Loads the previously saved view state of the PagerSettings object.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.SaveViewState()

This API supports the product infrastructure and is not intended to be used directly from your code. Saves the current view state of the PagerSettings object.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.TrackViewState()

This API supports the product infrastructure and is not intended to be used directly from your code. Marks the starting point at which to begin tracking and saving view state changes to the PagerSettings object.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIStateManager.IsTrackingViewState

Gets a value that indicates whether the server control is tracking its view state changes.

Controls that support pagination (such as the GridView, DetailsView, and FormView controls) can display a set of controls called the pager that allows the user to navigate the pages within the control. The PagerSettings class is used by these controls to represent the properties of the pager. In general, the PagerSettings object is stored in the PagerSettings property of the control. You can customize the pager by setting the properties of the PagerSettings object.

The pager supports several different display modes. To specify the mode in which to display the pager, set the Mode property. The following table describes the different modes.

Mode

Description

NextPrevious

Previous-page and next-page buttons.

NextPreviousFirstLast

Previous-page, next-page, first-page, and last -page buttons.

Numeric

Numbered link buttons to access pages directly.

NumericFirstLast

Numbered-link, first-link, and last-link buttons.

When the Mode property is set to the NextPrevious, NextPreviousFirstLast, or NumericFirstLast value you can customize the text of the non-numeric buttons by setting the properties shown in the following table.

Property

Description

FirstPageText

Text for the first-page button.

PreviousPageText

Text for the previous-page button.

NextPageText

Text for the next-page button.

LastPageText

Text for the last-page button.

As an alternative, you can also display images for the non-numeric buttons by setting the properties as shown in the following table.

Property

Description

FirstPageImageUrl

The URL to an image to display for the first-page button.

PreviousPageImageUrl

The URL to an image to display for the previous-page button.

NextPageImageUrl

The URL to an image to display for the next-page button.

LastPageImageUrl

The URL to an image to display for the last-page button.

System_CAPS_noteNote

When an image property is set, the corresponding text property acts as the alternate text for the image. For example, when the FirstPageImageUrl property is set, the text that is specified by the FirstPageText property is displayed as the alternate text for the image. On browsers that support ToolTips, this text is also displayed as a ToolTip for the corresponding button.

When the Mode property is set to the Numeric or NumericFirstLast value, you can specify the number of page buttons to display in the pager by setting the PageButtonCount property.

The pager can be displayed at the top, the bottom, or both the top and bottom of a control. To specify the position of the pager, set the Position property. To show or hide the pager, use the Visible property.

The following code example demonstrates how to use the PagerSettings object that is contained in the PagerSettings property to customize the text of the buttons that are displayed in the pager row of a GridView control.


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>PagerSetting Example</title>
</head>
<body>
    <form id="form1" runat="server">

      <h3>PagerSetting Example</h3>

        <asp:gridview id="CustomerGridView"
          datasourceid="CustomerDataSource"
          autogeneratecolumns="true"
          datakeynames="CustomerID"  
          allowpaging="true"
          runat="server">

          <pagersettings mode="NextPreviousFirstLast"
            firstpagetext="First"
            lastpagetext="Last"
            nextpagetext="Next"
            previouspagetext="Prev"   
            position="Bottom"/> 

        </asp:gridview>

        <br/>

        <asp:label id="MessageLabel"
          forecolor="Red"
          runat="server"/>

        <!-- This example uses Microsoft SQL Server and connects  -->
        <!-- to the Northwind sample database. Use an ASP.NET     -->
        <!-- expression to retrieve the connection string value   -->
        <!-- from the Web.config file.                            -->
        <asp:sqldatasource id="CustomerDataSource"
          selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
          connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
          runat="server"/>

      </form>
  </body>
</html>

.NET Framework
Available since 2.0

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

Return to top
Show:
© 2016 Microsoft