meta info
- Title: Paging TagHelper Basic Setup
- Keywords: asp.net-core, taghelpers, paging, control, pagination, attributes
- Description: Basic setup of PagingTagHelper for Asp.Net Core.
- Author: Ziya Mollamahmut
- Date: 08-Aug-2020
- Image: https://github.com/LazZiya/Docs/raw/master/LazZiya.TagHelpers/v6.0/images/lazziya-tagheleprs-logo.png
- Image-alt: LazZiya.TagHelpers Logo
- Version: v6.0
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 can be customized using html
or json
attributes:
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!