问题描述
我增加了PagedList我的看法和松散按照此Tutorial.我已经安装使用的NuGet的PagedList参考,建立我的控制器如下:
I am adding a PagedList to my view and loosely following this Tutorial. I have installed the PagedList reference using Nuget, set up my controller as follows
public ViewResult Index(int page = 1)
{
List<Part> model = this.db.Parts.ToList();
const int pageSize = 20;
return View(model.ToPagedList(page, pageSize));
}
和在上面写了我用下面的模型视图
And written my view with the following model at the top
@model PagedList.IPagedList<RIS.Models.Part>
当我运行页面,我得到了以下错误
When I run the page I get the following error
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属性设置为真,我曾尝试包括视图名称空间\\ Web.Config中在我的特定的区域。我还能做些什么来让浏览体验的命名空间?
The PagedList dll is being properly loaded in my controller because when I take it out of my view everything works as expected. The CopyLocal property is set to 'True' and I have tried including the namespace in the Views\Web.Config in my specific Area. What else can I do to make the View see the Namespace?
推荐答案
有些事情搞砸了我的整个项目。我创建了一个新的项目,并在复制的重要项目,这一切工作了。我不知道在所有的什么是错的我原来的项目。
Something is messed up with my overall project. I created a new project and copied the important items over and it all works now. I am not sure at all what is wrong with my original project.
这篇关于命名空间中的MVC 3的Razor视图未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!