我正在开发一个在线图书购物网站,在这个网站中,我在从数据库动态生成的视图上显示图书及其描述。但我想每页显示 10 本书,并在页面底部显示一个链接以转到下一页以查看接下来的 10 本书。在这里,我附上了我的代码,它从数据库中获取所有数据并在一个页面中一次显示所有书籍。我如何在此实现分页功能..
@{
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>