开发者

MVC 3 razor layout

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?


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


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


@{
ViewBag.Title = "Progress";
Layout = null;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜