Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 611
pramodtech Avatar asked May 05 '11 05:05

pramodtech


People also ask

Can you use MVC with razor pages?

You can add support for Pages to any ASP.NET Core MVC app by simply adding a Pages folder and adding Razor Pages files to this folder. Razor Pages use the folder structure as a convention for routing requests.

Which is better MVC or razor?

From the docs, "Razor Pages can make coding page-focused scenarios easier and more productive than using controllers and views." If your ASP.NET MVC app makes heavy use of views, you may want to consider migrating from actions and views to Razor Pages.

What is the difference between MVC and Razor?

A Razor Page is almost the same as ASP.NET MVC's view component. It has basically the syntax and functionality same as MVC. The basic difference between Razor pages and MVC is that the model and controller code is also added within the Razor Page itself. You do not need to add code separately.


1 Answers

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

like image 191
Adam Tuliper Avatar answered Sep 28 '22 04:09

Adam Tuliper