x19
x19

Reputation: 8783

Contents nested master page did not show

I'm using umbraco CMS version 4.11.3 Content nested master pages did not load(or show). (content header template did not show.) please help me.

My Template structure Master.master code:

<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>

<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <!doctype html>
    <html>
    <head title="Movafaqiyat" runat="server">

    </head>
    <body>
        <form id="form1" runat="server">
            <div id="MasterMaster" style="width: 100%;">
                <div style="width: 100%;">
                    <asp:ContentPlaceHolder ID="HeaderParentContent" runat="server">
                    </asp:ContentPlaceHolder>
                </div>
                <div style="width: 100%;">
                    <asp:ContentPlaceHolder ID="MenuContent" runat="server">
                    </asp:ContentPlaceHolder>
                </div>
                <div style="width: 100%;">
                    <asp:ContentPlaceHolder ID="FooterParentContent" runat="server">
                    </asp:ContentPlaceHolder>
                </div>
            </div>
        </form>
    </body>
    </html>
</asp:Content>

Blockquote HeaderParent.master code:

<%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %>

<asp:Content ContentPlaceHolderID="HeaderParentContent" runat="server">
    <div id="HeaderParentMaster" style="width: 100%; border: 1px solid red;">
        <div>
            <asp:ContentPlaceHolder ID="HeaderContent" runat="server">
            </asp:ContentPlaceHolder>
        </div>
    </div>
</asp:Content>

Blockquote Header.master code:

<%@ Master Language="C#" MasterPageFile="~/masterpages/HeaderParent.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="HeaderContent" runat="server">
        <div style="width: 100%">
            Did not show HEADER.Master IN HERE!    
        </div>
    </asp:Content>

Upvotes: 2

Views: 1259

Answers (3)

amelvin
amelvin

Reputation: 9051

I think that you would be better off creating macros to encapsulate small pieces of functionality (like Header Content) and dropping them into the Master.master template. Rather than inheriting master pages where the child master pages are only there for simple rendering.

As the design stands you will be creating pages that use the design set up in the Header.master file — and I don't think that you actually want to do that. It would suggest that you will be creating a content page called header.aspx — based on the header.Master template — which sounds wrong.

The master pages can inherit structure and design - but the final template at the bottom of the chain is the basis for a page to be rendered containing fields setup in a connecting doctype — not merely for presentation.

Something like the following is an alternative, and put your rendered content (static or dynamic) in the macro — as a bonus the macro can then be cached in Umbraco:

<div style="width: 100%;">
    <asp:Macro ID="HeaderParentContent" runat="server" parm1="#inheritedValue"/>
</div>

If you intend to put content templates under the header.master template (eg MyPageTemplate.master) then your design would still work — but still seems a bit more complicated than it needs to be.

Upvotes: 1

x19
x19

Reputation: 8783

@BeaverProj and @amelvin: Thank a lot for your answers to me.They all useful for me. But I solved my problem with this method:

enter image description here

enter image description here

<form id="form1" runat="server">
   <div id="MasterMaster" style="width: 100%;">
       <uc1:HeaderControl runat="server" ID="HeaderControl" />
   <div>
       <asp:ContentPlaceHolder ID="defaultPageContent" runat="server">
       </asp:ContentPlaceHolder>
   </div>
 </form>

DefaultPage.master code:

<%@ Master Language="C#" MasterPageFile="~/masterpages/Menu.master" AutoEventWireup="true" %>

<%@ Register Src="~/usercontrols/DefaultControl.ascx" TagPrefix="uc1" TagName="DefaultControl" %>

<asp:Content ContentPlaceHolderID="defaultPageContent" runat="server">
    <uc1:DefaultControl runat="server" ID="DefaultControl" />
</asp:Content>

After applying these changes, I got what I needed. Now, when I run the program I see default page.

Upvotes: 1

BeaverProj
BeaverProj

Reputation: 2215

Is the Header template is assigned to any Content Pages? Try using that template as an altTemplate and see if it works:

http://yoursitedomain.com/Header.aspx

of

http://yoursitedomain.com/?altTempalte=Header

If that shows the content then it could simply be that the page you think has that template assigned to it, doesn't.

If you think its a bug, then perhaps file a bug report or ask this question on Our Umbraco.

Upvotes: 1

Related Questions