ASP.NET Core Tag Helper that simplifies pagination.
Switch branches/tags
Nothing to show
Clone or download
Latest commit af80679 May 25, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Update readme May 25, 2018
test/Pioneer.Pagination.Tests Merge conflicts May 25, 2018
.gitattributes Opening Commit Sep 8, 2016
.gitignore Opening Commit Sep 8, 2016
LICENSE Initial commit Sep 8, 2016
Pioneer.Pagination.sln Update nuget packages May 24, 2018 Update readme with clamping info May 25, 2018
publish-notes.txt Update publisher notes Nov 24, 2017

Pioneer Pagination

What is Pioneer Pagination?

Pioneer Pagination is an ASP.Net Core Tag Helper that produces a paginated list which is configured to a desired state. Pagination Image

Where can I get it?

Pioneer Pagination is available as a NuGet package.

How does it work?

  1. In your controller, you make a call to PaginatedMetaService which returns a PaginatedMetaModel.
  2. Your PaginatedMetaModel is then passed to your view so that the Tag Helper can utilize it.
  3. In your view, you bind the PaginatedMetaModel to an attribute and set a route on another attribute.
  4. The Tag Helper generates a paginated list.

How do I use it?

For a full working example, clone this repository and run the Pioneer.Pagination.Example project locally.


To install, run the following command from your package manager console:

PM> Install-Package Pioneer.Pagination

Gain access to the PaginatedMetaService service.

In your Startup.cs class, add PaginatedMetaService into your dependency injection container.

public void ConfigureServices(IServiceCollection services)
    services.AddTransient<IPaginatedMetaService, PaginatedMetaService>();

In your controller, add a reference to the IPaginatedMetaService interface and set it through dependency injection.

public class BlogController : Controller
    private readonly IPaginatedMetaService _paginatedMetaService;

    public BlogController(IPaginatedMetaService paginatedMetaService)
        _paginatedMetaService = paginatedMetaService;

Add PaginatedMetaModel to ViewBag

From your controller, bind the PaginatedMetaModel to your ViewBag.

public ActionResult Index(int page = 1)
	// Typically obtained from a service/repository
    var totalNumberInCollection = 100;
	// Typically obtained from configuration
    var itemsPerPage = 5;
    ViewBag.PaginatedMeta = _paginatedMetaService.GetMetaData(totalNumberInCollection, page, itemsPerPage);
    return View("Blog", post);

Add Tag Helper to your view

<pioneer-pagination info="@ViewBag.PaginatedMeta" route="/blog"></pioneer-pagination>


  • previous-page-text
    • default = next
  • previous-page-text
    • default = previous
<pioneer-pagination info="@ViewBag.PaginatedMeta" route="/blog" previous-page-text="hey" next-page-text="you"></pioneer-pagination>

What about styling?

The markup this produces is based on Foundation Pagination. This leaves you one of three options.

  1. Use Foundation and it will work out of the box.
  2. Map the classes to Bootstrap stylings.
  3. Use the starting CSS or sass files provided in the example.


The services will clamp out of range indexes passed to _paginatedMetaService.GetMetaData. If you pass a current page value < 1, it will be clamped to 1. If you pass a current page value > then the collectionSize \ itemsPerPage , it will get clamped to the last valid page.

Because the aggragation of data is handled independetly of the actual tag helper, you will need to insure you are clamping the requests coming from the user in the same manner.

Change Log


  • Account for out of range request for a page by clamping them.


  • Add configuration for previous and next verbiage - ryn0


  • Migarted to .NET Standard 2.x
  • Migarted example project to ASP.NET Core 2.x


  • Fixed Next button not being displayed
    • Next should be displayed up until last page.
    • Added supported UTs.


  • Upgrade to LTS 1.0.3
  • Fixed previous and next button indexing
    • Supporting UTs.