/ Published in: C#
How to load a different layout page for specific controller in case you need to change includes etc. Add to _ViewStart.cshtml
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
@{ string currentController = ViewContext.RouteData.Values["controller"].ToString(); if(currentController == "PCA" || currentController == "pca") { Layout = "~/Views/Shared/_LayoutPCA.cshtml"; } else { Layout = "~/Views/Shared/_Layout.cshtml"; } }