【发布时间】:2015-12-31 12:30:22
【问题描述】:
我在文件夹 Views-Department 中有我的视图“Create.cshtml”。我想使用位于根文件夹中的局部视图,名为“_EnterpriseStructure.cshtml”的“CommonViews”。 我正在使用语法 RenderPartial
@{Html.RenderPartial("~/CommonViews/_EnterpriseStructure.cshtml");}
部分查看代码
<div id="Client">
This is a Partial View.
</div>
执行时出现 System.InvalidOperationException。
详细错误是:
“~/CommonViews/_EnterpriseStructure.cshtml”处的视图必须派生自 WebViewPage 或 WebViewPage。
我正在使用 ASP.Net MVC 5 Razor 视图
【问题讨论】:
标签: asp.net-mvc razor html.renderpartial