@{ List users = (List)ViewBag.Users;
foreach (ExaminationHerp.BookTable item in users)
{
<div class="rightmaintopcontent"> <a href="#"><img src="@item.Img" border="0" style="float:left";"width:41px;height:64px" /></a>
<div style="float:left; width:154px">
<div class="wen1">@item.BookName
<div>
<div class="wen2">出版社:@item.Press</div>
<div class="wen3">价格¥@item.Money(7.1折)</div>
<div class="wen4"><img src="~/BooxCssJsImg/img/che1.png" border="0"/> <a href="#">购买</a> | <img src="~/BooxCssJsImg/img/da.png"/><a href="#">放大预览</a></div>
</div>
</div>
</div>
</div>
</div>
} }
遍历完之后如何写分页啊 一页四个
最好是后台数据库做数据分页,然后用ajax请求数据然后渲染到页面,每次后台把总页数传过来,你就知道有多少页了,然后把页码按钮遍历出来,每个按钮
上面带一个页码的值,点击了之后传给后台,后台就知道请求第几页的数据,就会相应的把数据返回给前台
在数据库查询时就进行分页查询,前台显示当前页码,当点击上页或下页时把当前页的页码值传到后台再进行分页查询。