对其他视图/文件夹中的文件使用 Html.RenderPartial
如何将 Html.RenderPartial 用于其他文件夹中的 PartialView?
我尝试过:
<% Html.RenderPartial("~/Views/User/Users.ascx", Model); %>
它引发了错误:
System.InvalidOperationException: The partial view '~/Views/User/Users.ascx' was not found. The following locations were searched:
~/Views/Main/~/Views/User/Users.ascx.aspx
~/Views/Main/~/Views/User/Users.ascx.ascx
~/Views/Shared/~/Views/User/Users.ascx.aspx
~/Views/Shared/~/Views/User/Users.ascx.ascx
这里缺少任何内容或者无法调用其他文件夹中的partialview吗?
How to use Html.RenderPartial for the PartialViews in other Folders?
I have tried as:
<% Html.RenderPartial("~/Views/User/Users.ascx", Model); %>
It thrown an error:
System.InvalidOperationException: The partial view '~/Views/User/Users.ascx' was not found. The following locations were searched:
~/Views/Main/~/Views/User/Users.ascx.aspx
~/Views/Main/~/Views/User/Users.ascx.ascx
~/Views/Shared/~/Views/User/Users.ascx.aspx
~/Views/Shared/~/Views/User/Users.ascx.ascx
Is anything missing here or its not able to call partialview in other folders?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想更改查找部分、视图或母版页的规则,则必须更改 ViewEngine。
If you want to change the rule for finding partials, vieww or masterpages you have to change the ViewEngine.