【发布时间】:2011-06-02 03:14:54
【问题描述】:
我打算在 Site.Master 中使用经典的两列布局,但没有任何反应。我在 Views/Shared 文件夹中创建了一个新的 _LayoutClient.cshtml 文件,并在同一文件夹中创建了一个 Site.Master 文件。通过控制器类的正常过程,我有一个简单的公共 ActionResult Index() 方法。添加新视图文件时,我检查了'使用布局或母版页:_LayoutClient.cshtml,用于索引示例(Index.cshtml)
对于 MVC3,有 _ViewStart.cshtml,所以你知道我不需要遵循 DRY 的过程。在我的 Site.Master 文件中,我完成了以下代码... (Site1.css 实际上来自 Steven Sanderson 的 Pro ASP.NET MVC 2 框架的 Sportstore 示例应用程序)
<asp:ContentPlaceHolder ID="head" runat="server">
<link rel="Stylesheet" href="~/Content/Site1.css" type="text/css" />
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<div id="header">
<div class="title">My Project</div>
</div>
<div id="categories">
Will put something useful here later
</div>
</asp:ContentPlaceHolder>
</div>
</form>
所以我只能假设我的 CSS 模板没有从 Site.Master 更新。我在 C# 中使用 VS 2010、ASP.NET MVC 3。请有人看看告诉我为什么没有两列布局。提前致谢。数据库数据正在通过。
【问题讨论】:
标签: asp.net-mvc-3