我正在为我的视图添加一个PagedList,并松散地跟在此Tutorial之后。我已经安装使用的NuGet的PagedList参考,建立我的控制器如下在MVC中找不到名称空间3剃须刀视图
public ViewResult Index(int page = 1)
{
List<Part> model = this.db.Parts.ToList();
const int pageSize = 20;
return View(model.ToPagedList(page, pageSize));
}
,并在顶部
@model PagedList.IPagedList<RIS.Models.Part>
写我用下面的模型视图当我运行页面,我得到以下错误
Compiler Error Message: CS0246: The type or namespace name 'PagedList' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 27:
Line 28:
Line 29: public class _Page_Areas_Parts_Views_Part_Index_cshtml : System.Web.Mvc.WebViewPage<PagedList.IPagedList<RIS.Models.Part>> {
的PagedList DLL被正确地加载在我的控制器,因为我把它拿出来我看的一切的时候按预期工作。 CopyLocal属性设置为'True',我试图在我的特定区域的Views \ Web.Config中包含命名空间。我还能做些什么来使View查看命名空间?
在对象浏览器,它看起来像命名空间是“PagedList”,这就是控制器与编制。 – PlTaylor