如何对指定控制器的部分共享视图进行分组?
是否可以告诉 ViewEngine 在指定控制器的其他文件夹中查找部分共享视图(而对于其他控制器则不能)?
我正在使用 WebFormViewEngine。
这就是我的 PartialViewLocations 目前的样子。
public class ViewEngine : WebFormViewEngine
{
public ViewEngine()
{
PartialViewLocationFormats = PartialViewLocationFormats
.Union(new[]
{
"~/Views/{1}/Partial/{0}.ascx",
"~/Views/Shared/Partial/{0}.ascx"
}).ToArray();
}
Is it possible to tell ViewEngine to look for partial shared views in additional folders for specified controllers (while NOT for others)?
I'm using WebFormViewEngine.
This is how my PartialViewLocations looks at the moment.
public class ViewEngine : WebFormViewEngine
{
public ViewEngine()
{
PartialViewLocationFormats = PartialViewLocationFormats
.Union(new[]
{
"~/Views/{1}/Partial/{0}.ascx",
"~/Views/Shared/Partial/{0}.ascx"
}).ToArray();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然。在这种情况下,不要更改 PartialViewLocationFormats;相反,做:
Sure. Don't change PartialViewLocationFormats in this case; instead, do: