62,046
社区成员
发帖
与我相关
我的任务
分享
public ActionResult Index(int? ipage)
{
var _category = db.Category.Where(c => c.CategoryID > 0).OrderBy(c => c.CategoryID);
int pageSize = 5;
int pageNumber = (ipage ?? 1);
return View(_category.ToPagedList(pageNumber, pageSize));
}
@model PagedList.IPagedList<MvcBalance.Models.Categorys>
@using PagedList.Mvc;
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
@{
ViewBag.Title = "Index";
}
<h2>Category Setting</h2>
<p>
@Html.ActionLink("Create New", "Create",null, new { @class = "hrefbutton" })
</p>
<table class="table_list">
<tr>
<th>
@Html.DisplayNameFor(model=>model.CategoryName) </th>
<th>
@*@Html.DisplayNameFor(model => model.CategoryDescription)*@
@model PagedList.IPagedList<MvcBalance.Models.Categorys>
@using PagedList.Mvc;
......
<table class="table_list">
<tr>
<th>
@Html.DisplayNameFor(model=>model.First().CategoryName) </th>
<th>
@model IEnumerable<MvcBalance.Models.Categorys>
@using PagedList.Mvc;
......