User Control not loading based on location

Posted by mwright on Stack Overflow See other posts from Stack Overflow or by mwright
Published on 2010-04-01T15:06:18Z Indexed on 2010/04/01 15:13 UTC
Read the original article Hit count: 297

I have an ASP.net MVC solution that uses nested master pages to load content. On the first Master page I load a header, then have the Content Placeholder, and then load a footer. This master page is referenced by another master page which adds some additional information based on the user being logged in or not.

When I load a page that references these master pages, the header loads, but the footer does not. If I move the footer up above the Content Place Holder it loads into the page.

Any ideas why this might be the case?

The code for the master page that contains the footer is as follows:

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
     <head runat="server">
        <title>
            <asp:ContentPlaceHolder ID="TitleContent" runat="server" />
        </title>
     </head>
    <body>
        <div class="header">
            <% Html.RenderPartial("Header"); %>
        </div>
        <div>
            <asp:ContentPlaceHolder ID="MainContent" runat="server">

            </asp:ContentPlaceHolder>
        </div>

        <div class="footer">
            <% Html.RenderPartial("Footer"); %>
        </div>
     </body>
</html>

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about master-pages