user1622436
user1622436

Reputation: 77

Avoid master page rendering in view

I just want to remove master page from report.cshtml. I have written like

 @{
      Layout= string.Empty;
      }

or

 @{
      Layout=null;
      } 

also tried in controller

  public ActionResult LLCReportsPopUp(string camp)
        {
            return PartialView("~/Views/Reports/Views/LCCReport.cshtml");
        }

But no result, please help.

Upvotes: 2

Views: 544

Answers (2)

Kaf
Kaf

Reputation: 33839

Copy your _ViewStart.cshtml into your Report view folder and then make Layout = null. Job done. It will remove the default master layout from your report

@{
   // Layout = "~/Views/Shared/_Layout.cshtml";
    Layout = null;
}

_ViewStart.cshtml on Views\Report folder overwrites _ViewStart.cshtml in Views folder

If you need to assign a second layout instead of removing it you can do it as;

@{
    Layout = "~/Views/Shared/_MySecond_Layout.cshtml";
}

Upvotes: 2

Joel Etherton
Joel Etherton

Reputation: 37543

Another option is simply to create a completely blank layout template and assign that one.

Upvotes: 0

Related Questions