I'm using ASP.NET MVC5, razor syntax. I need a specific "Create" view to NOT inherit the _Layout.cshtml
Shared View.
Basically, in this particular View, I don't want any of the _Layout.cshtml
features like the navigation menu, footer, etc.
I'm using ASP.NET MVC5, razor syntax. I need a specific "Create" view to NOT inherit the _Layout.cshtml
Shared View.
Basically, in this particular View, I don't want any of the _Layout.cshtml
features like the navigation menu, footer, etc.
Use.
@{
Layout = null
}
In whatever .cshtml
file you don't want to inherit the _layout.cshtml
It inherits Layout because of your _ViewStart.cshtml
file. Look at your ViewStart and delete related line. Then if you want to use Layout in your page you have to specify your Layout in each page.
Layout = null
seems like the best approach for me. –
Coster © 2022 - 2024 — McMap. All rights reserved.