Reputation: 17388
Is it possible to suppress the layout expressed in _ViewStart.cshtml
using ASP.NET MVC 3 for certain views of an app.
I understand that I can define the layout programmatically in the controller action. Maybe passing in ""
achieves that?
Upvotes: 16
Views: 16614
Reputation: 9804
You have two options
1) Use return PartialView()
from controller, it won't take Layout from View start
2) Assign Layout = null,
@{
Layout = null;
}
Check-out this interesting discussion and answer by marcind around this subject
Upvotes: 33
Reputation: 990
In order not to apply a layout, just assign null to the Layout property in your view:
@{
Layout = null;
}
<!DOCTYPE html>
...
Upvotes: 3