关于PagedList.Mvc的疑惑,求解!

zhaocheng761115 zhaocheng761115 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
PagedList.Mvc版本4.5

直接上代码:
Controller:
        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));
}

View.cshtml:
@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)*@


编译器错误消息: CS1061: “PagedList.IPagedList<MvcBalance.Models.Categorys>”不包含“CategoryName”的定义,并且找不到可接受类型为“PagedList.IPagedList<MvcBalance.Models.Categorys>”的第一个参数的扩展方法“CategoryName”(是否缺少 using 指令或程序集引用?)
请大侠指点这是为何?
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
zhaocheng761115
.NET社区 62,274 成员 668,968 内容