/ExicoPaginationCore

A pagination for aspnetcore applications

Primary LanguageC#MIT LicenseMIT

ExicoPaginationCore

A pagination for aspnet core applications. Easily create paginations for your tabular/list data display pages. By default the styling is done assuming that you are using bootstrap. But everything can be overridden and customized.

How to use

  1. Install from nuget Install-Package ExicoPaginationCore -Version 1.0.0

  2. In your Startup.cs add the pagination

    public void ConfigureServices(IServiceCollection services)
    {
    	services.AddExicoCorePagination();
    }
  3. Now import the namespace in your _ViewImports.cshtml by adding this following line

    @using ExicoPaginationCore

  4. Then in your view file use this extension method to render pagination

    @Html.RenderPagination()

    This method takes three parameters i.e.

    @Html.RenderPagination((int)ViewBag.TotalCount, (int)ViewBag.ItemsPerPage, config)
    1. Total result count

    2. Items per page

    3. And lastly IPagingConfig instance

      Note that, IPagingConfig can be injected and directly used (as the example above is using)

      @inject IPagingConfig config

      This config object is an instance of the DefaultPaginationConfig (uses bootstrap 4).

      You can also create and object of DefaultPaginationConfig , customize it and pass it as param.

      @Html.RenderPagination((int)ViewBag.TotalCount,(int)ViewBag.ItemsPerPage, new DefaultPaginationConfig()
      {
      HideNextOnLastPage = true,
      HidePrevOnFirstPage = true
      });

      or you can create an entirely new implementation of IPagingConfig and replace the default service registration.

There is a fully working demo project included , check it out TestApplication.csproj !

screenshot