@model PagerDemo.ViewModels.EmployeePageViewModel <script src="~/lib/jquery/dist/jquery.min.js"></script> <link href="~/lib/simplePagination.js/simplePagination.css" rel="stylesheet" /> <script src="~/lib/simplePagination.js/jquery.simplePagination.js"></script> <script src="~/scripts/site.js"></script> <table> <tr> <th>Id</th> <th>First Name</th> <th>Last Name</th> </tr> @foreach (var emp in Model.Employees) { <tr> <td>@emp.Id</td> <td>@emp.FirstName</td> <td>@emp.LastName</td> </tr> } </table> <ul id="emp-pagination" class="pagination"></ul> <input asp-for="Pager.NumberOfPages" type="hidden" id="hdnTotalNumberOfPages" value="@Model.Pager.NumberOfPages" /> <input asp-for="Pager.CurrentPage" type="hidden" id="hdnCurrentPage" value="@Model.Pager.CurrentPage" /> JavaScript $(function () { $('#emp-pagination').pagination({ pages: $('#hdnTotalNumberOfPages').val(), currentPage: $('#hdnCurrentPage').val(), itemsOnPage: 10, cssStyle: 'light-theme', onPageClick: function (pageNo) { var url = "/Home/Index?pageNumber=" + pageNo; window.location.href = url; }, hrefTextSuffix: '', selectOnClick: true }); });
<script> code jquery and js here </script>
$(...)
$(document).ready(...)
~/lib/simplePagination.js/jquery.simplePagination.js
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)