【问题标题】:Visual Studio - migrating to new layoutVisual Studio - 迁移到新布局
【发布时间】:2014-08-30 12:34:43
【问题描述】:

我在 Shared 文件夹中构建了一个使用默认布局 _Layout.cshtml 的应用程序。此应用程序至少有 100 个视图,我想开始将其迁移到新布局。在不摆脱 _Layout.cshtml 的情况下如何做到这一点?我希望其他视图现在使用 _Layout.cshtml 并且只让我的主页(主文件夹中的 index.cshtml)拥有新的布局。

我在主页中引用了样式表,但默认共享样式和新样式都在应用,这看起来很糟糕。

【问题讨论】:

标签: visual-studio-2012 razor


【解决方案1】:

如果您只想在 Index 页面上实现新布局,那么只需在 Index.cshtml 页面中包含 Layout explicitely ,如图所示:

@{
   Viewbag.Title = "Index";
   Layout = "// Give Path of new layout here //";
}

【讨论】:

    猜你喜欢
    • 2017-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多