14

I have a MVC 3 project in which I use _Layout.cshtml as master page in all web pages. Now I want to remove this master page (layout) from one of the page (progress.cshtml). So I removed the removed the top portion of the page which was

@{
    ViewBag.Title = "Progress";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

I thought this will work but when I browse progress page it still shows the content from layout file. How I can remove this binding?

K DawG
  • 13,287
  • 9
  • 35
  • 66
pramodtech
  • 6,300
  • 18
  • 72
  • 111

3 Answers3

17

Set the layout= null to remove the default layout inheritance in that view

Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71
7

the issue is there is a file named _viewstart.cshtml which behave as the config file to know the engine which is the masterfile.

For more info have a look:

http://weblogs.asp.net/gunnarpeipman/archive/2010/10/10/asp-net-mvc-3-beta-view-start-files-for-razor-view-engine.aspx

Thanks

Shakeeb Ahmed
  • 1,778
  • 1
  • 21
  • 37
5
@{
ViewBag.Title = "Progress";
Layout = null;
}
Thulasiram
  • 8,432
  • 8
  • 46
  • 54