在 FindView
方法中的自定义 View 引擎中,如何查看使用的 Layout
? masterName
始终为空。
ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) {
// How do I get WebViewPage.Layout to know what layout is used?
}
最佳答案
除非您使用 return View(string viewName, string masterName)
在 Controller 级别设置 master,否则 masterName
将始终为空。母版通常在 View 本身的编译过程中确定。
关于c# - .NET MVC 自定义 View 引擎布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7705728/