I am developing a online books shopping website and in this I display the books and their description on a view that is dynamically generated from database. But I want to show 10 books per page and a link on bottom of page to go to next page to see next 10 books. here I am attaching my code it fetch all data from database and show all books at atime in a single page. How I implement paging functionality in this..
@{
ViewBag.Title = "Contact";
}
@model IEnumerable<BusinessObject.Images>
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
<div id="content">
<!-- Products -->
<div class="products">
<h3>Featured Products</h3>
<ul>
@foreach (var item in Model)
{
<li>
<div class="product">
@Html.ActionLink(item.ImageName, "Details","Home", new { id = item.ImageId }, null)
<span class="holder">
<img src="@item.ImagePath" alt="">
<span class="@item.ImageName" >@item.ImageName</span>
<span class="author">by John Smith</span>
<span class="description">Maecenas vehicula ante eu enim pharetra<br />scelerisque dignissim <br />sollicitudin nisi</span>
</span>
</a>
<a href="#" class="buy-btn">BUY NOW <span class="price"><span class="low">$</span>22<span class="high">00</span></span></a>
</div>
</li>}
</ul>
</div>
<div class="cl"> </div>
</div>
You can request for only the required number of records from your database itself - Pagination
Check the link
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.