简体   繁体   中英

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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM