Pager

The pager tag helper allows links based paging of data. Its links are also able to perform ajax updates and Json data page retrieval as explained in the ajax links section

The pager component is templated since it has a customizable layout template. The default template for the default server controls tag helper provider is here.

See it live

In the example above the same pager is "pasted" also in the footer of a grid.

pager tag helper attributes

mode: enum PagerMode {OData=0, CustomPages}
In OData mote the pager puts in all its page links: number items to skip and number item to keep. In Custom mode the pager puts in all its page links: page number (1 is the first page), and the number of items per page
copy-html: string
When provided the html created by the pager is copied in a transfer area with the name specified in the string. This html may be pasted in several other places with the paste-html tag helper. Usefull to create several copies of the pager in various areas of a control (as for instance a grid with a pager both in the header and in the footer).
url-default: string, url: ModelExpression
Two ways to pass the url: as a constant, or in the View model. For server controls url-default suffices for both purposes, but for client contols where model is on the client side this is not the case. The url is expected to contains two tokens one for each of the parameters the pager specifies in each link. Tokens are replaced by actual parameter values.
skip-url-token: string
The string token that will be substituted either by the items to skip or by the page number, depending on the pager mode.
take-url-token: string
The string token that will be substituted by the number of items per page.
page-size-default: int, page-size: ModelExpression
Two ways to pass page size: as a constant, or in the View model. For server controls page-size-default suffices for both purposes, but for client controls where model is on the client side this is not the case.
current-page-default: int, current-page: ModelExpression
Two ways to pass current page: as a constant, or in the View model. For server controls current-page-default suffices for both purposes, but for client controls where model is on the client side this is not the case.
total-pages-default: int, total-pages: ModelExpression
Two ways to pass total pages: as a constant, or in the View model. For server controls total-pages-default suffices for both purposes, but for client controls where model is on the client side this is not the case.
ajax-id, ajax-endpoint
Used for ajax paging. Documented in the ajax links section.
max-pages: int
The maximum number of page links to show on the left and right of the current page.
localization-type: Type
A type that when provided is used to create a localizer to localize all strings contained in the pager (strings in some buttons for instance). See here for more infos on how types are used for localization.
class: string
Css class to be applied on the pager root node.
layout-template: string
A partial view implementing a custom layout template.

Fork me on GitHub