Created
October 2, 2018 15:24
-
-
Save mikebrind/6229c242af993d62ce342b5f73d5cf84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page | |
@model PaginationModel | |
<h2>Pagination Example</h2> | |
<table class="table table-striped"> | |
@foreach (var item in Model.Data) | |
{ | |
<tr> | |
<td>@item.Id</td> | |
<td>@item.FullName</td> | |
<td>@item.Country</td> | |
<td>@item.Email</td> | |
<td>@item.CreatedAt</td> | |
</tr> | |
} | |
</table> | |
<div> | |
<ul class="pagination"> | |
@for (var i = 1; i <= Model.TotalPages; i++) | |
{ | |
<li class="page-item @(i == Model.CurrentPage ? "active" : "")"> | |
<a asp-page="/pagination" asp-route-currentpage="@i" class="page-link">@i</a> | |
</li> | |
} | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am referring to your code.how to use sorting and paging here? I have added .cs code but i am getting current page 0 on click of 2nd page
@for (var i = 1; i <= Model.TotalPages; i++)
{
<li class="page-item @(i == Model.CurrentPage ? "active" : "")">
@i
}