在页面视图中编码我不好
控制器中的代码
#region Paging List
var pageNum = (int)Session["PageNumber"];
double productCount = list.Count();
var pageTotal = Math.Round(productCount / pageSize);
if (pageTotal <= 1)
pageTotal = 1;
int skip = (pageNum - 1) * pageSize;
ViewBag.PageID = pageNum;
ViewBag.Count = productCount;
ViewBag.PageCount = pageSize;
ViewBag.PageTotal = pageTotal;
list = list.Skip(skip).Take(pageSize).ToList();
#endregion
视图中的代码:
<div class="pagenavi">
<a href="javascript:void(0)" onclick="GotoPageN(1)" class="pull-right">
<i class="icon-perv-slide"></i>
</a>
@for (int i = 1; i <= (ViewBag.Count / ViewBag.PageCount) + 1; i++)
{
<a href="javascript:void(0)" onclick="GotoPageN(@i)" class="@(((int)ViewBag.PageID == i) ? "current" : "")">@i</a>
}
<a href="javascript:void(0)" onclick="GotoPageN(@(ViewBag.PageTotal))" class="pull-left"><i class="icon-next-slide"></i></a>
</div>
JavaScript中的代码
function GotoPageN(pagenumber) {
// $('html, body').animate({ scrollTop: 0 }, '500', 'swing');
$('html,body').scrollTop(0);
$("#divCategoryPartial").block({ message: "<img alt='' src='/Images/SiteImages/loaders/akalaz-logo.png' /> <img alt='' class='auto-style1' src='/Images/SiteImages/loaders/3d_2.gif' />" });
$.ajax({
url: "/ProductList/GotoPageN",
type: "Get",
data: { pagenumber: pagenumber }
}).done(function (result) {
$('#list').html(result);
$("#divCategoryPartial").unblock();
});
帮我编辑视图页面的代码
&LT; 12345 ... 34 35&gt;
分页视图