使用跨多个区域的局部视图 - MVC4
我想使用跨多个区域的视图。我已将有问题的部分视图放入主应用程序 Views/Shared 文件夹中,但我似乎无法访问它。
有谁知道如何访问共享视图文件夹?
我当前使用的代码是基本的:
@Html.RenderPartial("MyPartialControl")
I am wanting to use a view across multiple areas. I have put the partial view in question into the main application Views/Shared folder, but I cannot seem to access this.
Does anyone know how to access the shared view folder?
The code i am currently using is the basic:
@Html.RenderPartial("MyPartialControl")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过使用完整路径?
Have you tried using full path?
以防万一,如果您还没有找到解决方案(我怀疑)...试试这个,它对我有用。
@Html.RenderPartial("~\\Views\\Shared\\MyPartialControl.cshtml")
对于 C# 和单个 '\' 对于 VB.NETJust in case, if you have not found the solution yet (I doubt)... try this, it worked for me.
@Html.RenderPartial("~\\Views\\Shared\\MyPartialControl.cshtml")
for C# and single '\' for VB.NET