Skip to content

<Pager>

<Pager> configures how the pagers above and below a list view look and behave. It's a child of <xmod:Template> or <xmod:DataList> — it doesn't stand on its own.

The tag's attributes set things like page size, captions, and CSS classes. Optional inner content (the display template) lets you arrange the navigation links and page-info tokens with your own HTML.

SEO-friendly paging

Set Type="Hyperlink" (since v4.5) and the pager renders standard <a href="..."> links instead of postback buttons. Each click is a fresh request — search-engine crawlers can follow the links and index every page. Other modules on the page may lose state on hyperlink clicks, so use this when crawlability is more important than module-state preservation.

Turning paging off

To disable paging entirely (show all rows on a single page), set UsePaging="False" on the parent <xmod:Template> or <xmod:DataList> instead of removing the <Pager> tag.

Example

html
<xmod:Template ...>
  ...
  <Pager PageSize="15" PageNumCssClass="CommandButton"
         FirstPageCaption="[First]" LastPageCaption="[Last]">
    <table>
      <tr>
        <td>Page <strong>{PageNumber}</strong> of {PageCount}</td>
        <td align="right">{Pager}</td>
      </tr>
    </table>
  </Pager>
  ...
</xmod:Template>

Properties

Layout & sizing

PropertyValuesDefaultDescription
PageSizeinteger10Maximum number of records on each page
MaxPageNumButtonsinteger5Maximum number of page-number buttons between Previous and Next
ShowTopPagerTrue FalseTrueWhen False, the pager above the list is hidden (since v1.2)
ShowBottomPagerTrue FalseTrueWhen False, the pager below the list is hidden (since v1.2)
ShowPrevNextTrue FalseTrueWhen False, the Previous / Next links are hidden
ShowFirstLastTrue FalseFalseWhen True, First / Last links appear at each end of the pager
ScrollToTopTrue FalseTrueAfter clicking a link in the bottom pager, scroll the page to the top of the view (since v4.0)

Pagers vs. paging

ShowTopPager and ShowBottomPager only hide the pager UI — paging still happens. With both set to False, only the first page renders and visitors have no way to reach later pages.

Captions

PropertyDefault
FirstPageCaptionFirst
PrevPageCaptionPrev
NextPageCaptionNext
LastPageCaptionLast

CSS classes

PropertyDefaultApplies to
PageNumCssClassCommandButtonPage-number buttons
PrevNextCssClassCommandButtonPrevious and Next links
FirstLastCssClassCommandButtonFirst and Last links
CurrentPageCssClassThe current page's button (overrides PageNumCssClass for that one)
FirstPageCssClassFirst-page link only (overrides FirstLastCssClass for that one)
LastPageCssClassLast-page link only
PrevPageCssClassPrevious-page link only (overrides PrevNextCssClass for that one)
NextPageCssClassNext-page link only

SEO-friendly mode

Set Type="Hyperlink" to enable. The four *ParameterName properties control the URL parameters the hyperlink pager uses to communicate state.

PropertyValuesDefaultDescription
TypeLinkButton HyperlinkLinkButtonWhen Hyperlink, the pager renders <a href> links instead of postback buttons (since v4.5)
PageParameterNamestringpgURL parameter that carries the page number
SearchValueParameterNamestringsvURL parameter that carries the search phrase
SortColumnParameterNamestringscURL parameter that carries the sort column name
SortOrderParameterNamestringsoURL parameter that carries the sort order

Display Template

Place HTML between <Pager> and </Pager> to arrange the pager's parts manually. If no inner content is supplied, XMP uses its built-in default layout.

Three placeholders are substituted at render time:

TokenReplaced with
{PageNumber}The current page number
{PageCount}The total number of pages
{Pager}The First / Prev / page-number buttons / Next / Last links, in order
html
<Pager PageSize="20">
  <div class="my-pager">
    <span>Page {PageNumber} of {PageCount}</span>
    <span>{Pager}</span>
  </div>
</Pager>