0

I have various cshtml pages where I want different _Layout.cshtml files to apply. I know that the MVC library uses _ViewStart.cshtml, but I have not yet found examples of code that will allow me to select with _Layout is applied to which page.

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
Larry
  • 23
  • 5
  • whats wrong with using Layout = "xxxx" at the beginning of your cshtml file – Steve Dec 13 '17 at 15:05
  • check out this question, I think it should answer yours: https://stackoverflow.com/questions/5161380/how-do-i-specify-different-layouts-in-the-asp-net-mvc-3-razor-viewstart-file – Mykhailo Seniutovych Dec 13 '17 at 15:08
  • @MykhailoSeniutovych—yep—that'll do it. – Larry Dec 13 '17 at 15:14
  • After a little digging, I also found: http://www.dotnettricks.com/learn/mvc/different-ways-of-rendering-layouts-in-aspnet-mvc – Larry Dec 13 '17 at 15:15
  • @Larry You can also use `@{ Layout = null; }` in your view to not apply any layouts to your view. – Mykhailo Seniutovych Dec 13 '17 at 15:19
  • Possible duplicate of [How do I specify different Layouts in the ASP.NET MVC 3 razor ViewStart file?](https://stackoverflow.com/questions/5161380/how-do-i-specify-different-layouts-in-the-asp-net-mvc-3-razor-viewstart-file) – Markus Dec 13 '17 at 15:56

0 Answers0