[英]How can I implement Nested Master Pages in ASP.NET MVC RC2?
I have a main MasterPage which has a single column layout for the web application I am currently designing.我有一个主 MasterPage,它为我目前正在设计的 web 应用程序提供单列布局。 I want to re-use the existing MasterPage to implement a two column layout using Nested MasterPages which was possible on previous releases of the ASP.NET MVC Framework but I can't seem to get it to work in the RC2.我想重新使用现有的 MasterPage 来使用嵌套的 MasterPages 实现两列布局,这在 ASP.NET MVC 框架的先前版本中是可能的,但我似乎无法让它在 RC2 中工作。
The following is the code I am currently working on,以下是我目前正在处理的代码,
<%@ Master Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewMasterPage" %>
<%@ Import Namespace="RHP.WebMvcApplication.Library" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
<asp:ContentPlaceHolder ID="TitleContent" runat="server">
Member List
</asp:ContentPlaceHolder>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="mainLeftContent">
<h3>Options</h3>
<%= Html.MenuCurrentChildren(); %>
</div>
<div id="mainContent">
<% Html.RenderPartial("MemberApplicationStateControl"); %>
<asp:ContentPlaceHolder id="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</asp:Content>
Nevermind.没关系。 I had a bug in the page that was stopping the page from being rendered so it does work now.我在页面中有一个错误,它阻止了页面的呈现,所以它现在可以工作了。
The bug was the (;):错误是(;):
<div id="mainLeftContent">
<h3>Options</h3>
<%= Html.MenuCurrentChildren(); %>
</div>
The fix was:解决方法是:
<div id="mainLeftContent">
<h3>Options</h3>
<%= Html.MenuCurrentChildren() %>
</div>
Its the little stuff that makes programming interesting.它是使编程变得有趣的小东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.