liveBook · Manning

Page link

As explained in Pro ASP.NET Core 7, Tenth Edition

A page link is a hyperlink that navigates to a specific page of a paginated collection.

A page link is a hyperlink that navigates to a specific page of a paginated product collection. In ASP.NET Core, a tag helper can generate the links from paging data instead of forcing customers to discover query-string parameters. section 7.4.1

A practical implementation connects four pieces:

  • A PagingInfo view model carries total items, items per page, and the current page; TotalPages is calculated from those values. section 7.4.1
  • The controller selects products with Skip and Take, then passes products and PagingInfo through ProductsListViewModel. section 7.4.1
  • A PageLinkTagHelper targets a div with page-model and populates it with page-specific anchor elements. section 7.4.1
  • The view renders the helper with page-model="@Model.PagingInfo" and page-action="Index". section 7.4.1

Navigating to page two

A request such as http://localhost:5000/?productPage=2 selects the second product page; rendered links make that navigation discoverable. section 7.4.1

http://localhost:5000/?productPage=2

Inspect the concrete URL used to request the second page of products. section 7.4.1

How Pro ASP.NET Core 7, Tenth Edition covers it

How deep it goes
Builds paging metadata, controller selection, a tag helper, view integration, and tests, but omits detailed tag-helper internals.
Examples
Uses a SportsStore product catalog, a productPage=2 URL, PagingInfo, PageLinkTagHelper, and generated navigation links.
What it assumes
Assumes basic ASP.NET Core MVC and Razor knowledge while deferring detailed tag-helper instruction to later treatment.
What you can do after
Build it from scratch by combining controller pagination, a paging view model, a tag helper, and a Razor view.
How it connects
Connects pagination with ASP.NET Core tag helpers, Razor views, controllers, view models, repositories, and query strings.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro ASP.NET Core 7, Tenth Edition. The section links point to the parts of the book it draws on.