从视图中删除主布局 (MVC2)

发布于 2024-08-18 16:22:49 字数 258 浏览 5 评论 0原文

如果我需要从我的视图中删除主布局,我该如何在 MVC2 中做到这一点? 我尝试将文档中显示的代码放入我的视图 http://sparkviewengine.com/documentation/master-布局:,但它仍然带来我的 Application.spark 布局:-/

有什么想法吗?

if i need remove master layout from my view, how can i do it in MVC2?
i tried put code in my view that was shown in documentation http://sparkviewengine.com/documentation/master-layouts: , but it still bring my Application.spark layout :-/

any ideas why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍景流年 2024-08-25 16:22:49

我知道这个答案有点晚了(也许晚了很多),但您也可以使用 PartialView 方法。

相关 Spark 文档

  • Views/Layouts 文件夹或 Views/Shared 文件夹中的 Application.spark 文件

这是拥有站点范围主模板的最通用方法。如果控制器返回 PartialView(),则不会使用它。

I know this answer is a litle (maybe a lot) late but you can also use the PartialView method if you mean to render an HTML fragment instead of the full page.

Relevant Spark documentation

  • An Application.spark file in the Views/Layouts folder or Views/Shared folder

This is the most general-purpose way to have a site-wide master template. It will not be used if the controller returns a PartialView().

无人问我粥可暖 2024-08-25 16:22:49

未经测试,但如果您创建并清空主布局,并在视图顶部说 会怎样?或者您可以从控制器调用空主机; return View("View", "EmptyMaster");

不知道它是否有效,但值得一试。

Not tested, but what if you create and empty master layout, and say <use master="EmptyMaster" /> in the top of your view? Or you could call on the empty master from the controller; return View("View", "EmptyMaster");

Don't know if it'll work, but it's worth a shot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文