meta info

Paging TagHelper Basic Setup

By Ziya Mollamahmut

Default setup

Paging taghelper requires below parameters to render the paging control:

<paging page-no="Model.PageNo"
        page-size="Model.PageSize"
        total-records="Model.TotalRecords">
</paging>

Output:

PagingTagHelper - default

Customized setup

PagingTagHelper can be customized using html or json attributes: PagingTagHelper - customization

Using custom URL tempalte

If you want to customize the URL for paging links, replace the value of url-template of any custom string value that contains two place holders, {0} for page no, and {1} for page size.

<!-- custom url template -->
<!-- this will create a paging link as "/1-10" -->
<!-- (page-no, page-size) -->
<paging total-records="Model.TotalRecords" 
        page-no="Model.PageNo" 
        page-size="Model.PageSize" 
        url-template="{0}-{1}">
</paging>

If url-template value is not set, the default template will be applied including all query string parameters defined in the page route.

IMPORTANT: When setting this value manually, you need to include two place holdres for page no and page size, and make sure you include all other query string parameters if any manually to the template!