views:

1481

answers:

2

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.

Any suggestions are welcomed! The following is the code I am currently working on,

Thanks,

Roberto

<%@ 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>
+3  A: 

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.

Thanks,

Roberto

Roberto Hernandez
A: 

DIY ASP.NET MVC nested master page item template:

download ref: http://files.cnblogs.com/ILoveSilence/MvcViewNestedMasterPageItemTemplatev1.cs.zip