PlT*_*lor 9 razor asp.net-mvc-3
我正在为我的视图添加一个PagedList,并且松散地遵循本教程.我已经使用Nuget安装了PagedList引用,按如下方式设置我的控制器
public ViewResult Index(int page = 1)
{
List<Part> model = this.db.Parts.ToList();
const int pageSize = 20;
return View(model.ToPagedList(page, pageSize));
}
Run Code Online (Sandbox Code Playgroud)
并在顶部用以下模型编写我的视图
@model PagedList.IPagedList<RIS.Models.Part>
Run Code Online (Sandbox Code Playgroud)
当我运行页面时,我收到以下错误
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>> {
Run Code Online (Sandbox Code Playgroud)
PagedList dll正在我的控制器中正确加载,因为当我从视图中取出它时,一切都按预期工作.CopyLocal属性设置为'True',我尝试在我的特定区域的Views\Web.Config中包含命名空间.我还能做些什么来使视图看到命名空间?