Guest User

Guest User

  • Tech Writer
  • 75
  • 1.7k

Implement Pagination Using .

Jun 8 2021 7:14 AM

I have use this code for pagination

return customEntityResult.ChangeType(blogPosts.Skip((pageNumber-1)*pageSize).Take(pageSize));

<nav aria-label="Page navigation example">
    <ul class="pagination">
        <li class="page-item"><a class="page-link" href="#">Previous</a></li>
        <li class="page-item"><a class="page-link" href="#">1</a></li>
        <li class="page-item"><a class="page-link" href="#">2</a></li>
        <li class="page-item"><a class="page-link" href="#">3</a></li>
        <li class="page-item"><a class="page-link" href="#">Next</a></li> --but  here face a problem this is static value how to genreate this number base on record 
    </ul>
</nav>

<script type="text/javascript">
    $('.pagination li a').click(function (event) {
        event.preventDefault();
        var id = $(this).text();
        $.ajax({
            url: "/Utility/PageidForblog?Id=" + id,
            type: "POST",
            dataType: "html",
            traditional: true,
            contentType: "application/json; charset=utf-8",
            success: function (record) {
                $(".blog-layout-content").html("");
                $(".blog-layout-content").html(record);
            },
        });
    });
</script>


Answers (1)