Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET MVC Custom viewengine layout

In a custom viewengine in the FindView method, how can I see the Layout used? masterName is always empty.

ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) {
    // How do I get WebViewPage.Layout to know what layout is used?
}
like image 892
jaap Avatar asked Oct 09 '11 18:10

jaap


1 Answers

Unless you are setting your master at the controller level with return View(string viewName, string masterName), the masterName will always be empty. The master is typically determined during the compilation of the view itself.

like image 153
Nathan Taylor Avatar answered Sep 19 '22 10:09

Nathan Taylor