Paging TagHelper - Ajax >= v4.0

Ajax Sample : Cultures Table

LCID English Name Native Name
54 Afrikaans Afrikaans
1078 Afrikaans (South Africa) Afrikaans (Suid-Afrika)
28 Albanian Shqip
1052 Albanian (Albania) Shqip (Shqipëria)
132 Alsatian Elsässisch
1156 Alsatian (France) Elsässisch (Frànkrisch)
94 Amharic አማርኛ
1118 Amharic (Ethiopia) አማርኛ (ኢትዮጵያ)
1 Arabic العربية
5121 Arabic (Algeria) العربية (الجزائر)

Setup for ajax

  • Create a div element that will handle the updated the content
    <div class="items"></div>
  • Create a partial view to render in the target area e.g. PagingItemsPartial.cshtml. The partial view model is the same as the page model in out sample PagingAjaxModel.
  • Put the paging taghelper in the partial, currently it supports only "replace" mode for ajax, thats why we have to keep the paging inside the partial, so it will refresh with the partial data accordingly.
  • Use ajax-... attributes to add ajax support to the PagingTagHelper.
  • In the backend, create the relevant handler that will return the partial view via ajax.
  • Add reference to ajax in the Scripts section:
    <script src=""></script>

Sample partial view with Paging control included

@model PagingAjaxModel

<table class="table table-striped">
            <th>English Name</th>
            <th>Native Name</th>
        @if (Model.TotalRecords == 0)
                <td colspan="3">No records!</td>
            foreach (var c in Model.CulturesList)
            <td colspan="3">
                <paging page-no="Model.P"