I created a partial view and can't access the Html namespace for HTML Helpers. It's available in the main view. Am I missing something?
我创建了一个局部视图,无法访问HTML Helpers的Html命名空间。它在主视图中可用。我错过了什么吗?
EDIT: I should mention that I'm using ASP.NET MVC 5.
编辑:我应该提到我正在使用ASP.NET MVC 5。
1 个解决方案
#1
1
check is there a web.config in you views directory and in the web.config
检查视图目录和web.config中是否有web.config
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
#1
1
check is there a web.config in you views directory and in the web.config
检查视图目录和web.config中是否有web.config
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>