I just want to remove master page from report.cshtml. I have written like
我只想从report.cshtml删除母版页。我写了像
@{
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.
但是没有结果,请帮忙。
2 个解决方案
#1
2
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
模仿你的_ViewStart。将cshtml放入报表视图文件夹,然后使布局= null。工作。它将从报表中删除默认的主布局
@{
// Layout = "~/Views/Shared/_Layout.cshtml";
Layout = null;
}
_ViewStart.cshtml
on Views\Report folder overwrites _ViewStart.cshtml
in Views folder
_ViewStart。cshtml on Views\Report文件夹覆盖_ViewStart。cshtml视图文件夹中
If you need to assign a second layout instead of removing it you can do it as;
如果你需要分配第二个布局而不是删除它,你可以这样做;
@{
Layout = "~/Views/Shared/_MySecond_Layout.cshtml";
}
#2
0
Another option is simply to create a completely blank layout template and assign that one.
另一个选择是创建一个完全空白的布局模板并分配它。
#1
2
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
模仿你的_ViewStart。将cshtml放入报表视图文件夹,然后使布局= null。工作。它将从报表中删除默认的主布局
@{
// Layout = "~/Views/Shared/_Layout.cshtml";
Layout = null;
}
_ViewStart.cshtml
on Views\Report folder overwrites _ViewStart.cshtml
in Views folder
_ViewStart。cshtml on Views\Report文件夹覆盖_ViewStart。cshtml视图文件夹中
If you need to assign a second layout instead of removing it you can do it as;
如果你需要分配第二个布局而不是删除它,你可以这样做;
@{
Layout = "~/Views/Shared/_MySecond_Layout.cshtml";
}
#2
0
Another option is simply to create a completely blank layout template and assign that one.
另一个选择是创建一个完全空白的布局模板并分配它。