Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Solomon Closson 22 posts 42 karma points
    Oct 23, 2014 @ 20:01
    Solomon Closson
    0

    How to load ContentPlaceHolders from Master.Master Page, not Templates?

    Basically, in Umbraco 4.7.1, I was able to load Master.Master file from root of Umbraco site, and just put the following code in all template files in Umbraco: Settings->Templates:

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    </asp:Content>​
    

    Than in the Master Page on the root: Master.Master (not sure where that was defined at), I just had my content placeholders defined, where all of my Template Files (also, in the root of Umbraco Site) would call those *ContentPlaceHolder IDs in an <asp:Content /> element. Installing Umbraco 7.1 does not want to work like this. In Umbraco 7.1, I have the following code in my templates in Settings -> Templates:

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" Inherits="Umbraco.Web.UI.Umbraco.Masterpages.Default" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    </asp:Content>
    

    I have no Master Templates defined in Umbraco (which is the same setup I had for 4.7.1, that worked in that version). In the root of the site, I have All Template Alias's (from Umbraco for each template), defined as TemplateHome.aspx, and TemplateHome.aspx.cs (which also worked in umbraco 4.7.1), than I have the Master.Master file in the root of the site with the following ContentPlaceHolders defined in it (where each .aspx file, connects to with <asp:Content /> elements:

    Master.Master ContentPlaceHolders:

    <asp:ContentPlaceHolder ID="TheDocTypeContentPlaceHolder" runat="server"></asp:ContentPlaceHolder>
    <head>
    <!--// Global Stuff in here... //-->
    <asp:ContentPlaceHolder ID="TheHeadContentPlaceHolder" runat="server"></asp:ContentPlaceHolder>
    </head>
    <body>
    <!--// Conditional Stuff in here... //-->
    <asp:ContentPlaceHolder     ID="TheContentPlaceHolder"  runat="server" />
    </body>
    </html>
    

    How to set this up so that All ContentPlaceholders are used from the Master.Master file in the sites root?? If I put in the following Code, it loads up the Master.Master file... but does not load up any of the Content from the .aspx files (Where the .aspx file is the same as the Template Alias Name, if that even matters):

    <%@ Master Language="C#" MasterPageFile="~/Master.master" Inherits="Umbraco.Web.UI.Umbraco.Masterpages.Default" AutoEventWireup="true" %>
    

    So, basically, all ContentPlaceHolders do not render from this page at all.... Why? Like I said, this rendered fine in Umbraco 4.7.1, just not happening in 7.1. What must I do to get this connected properly in Umbraco 7.1?

    Also, I have edited the Umbraco.config to use as Webforms, not Mvc (though, it doesn't matter what I do, cause it still doesn't work in either way).

    In Umbraco 4.7.1, there was ASP.NET MasterPages automatically Enabled. Not sure if this is an option in Umbraco 7.1, but could possibly be needed??

  • Sören Deger 733 posts 2844 karma points c-trib
    Oct 23, 2014 @ 20:20
    Sören Deger
    0

    Hi Solomon,

    Umbraco 7 works in MVC by default, but you can change this. After you set the mode from MVC to WebForms in umbraco.config you must recycle the application pool so that the changes are applied.

     

    Sören

  • Solomon Closson 22 posts 42 karma points
    Oct 23, 2014 @ 20:38
    Solomon Closson
    0

    Ok, so I have just recycled the Application Pool, just now. Reloading the Page still shows Blank Page... HomeTemplate has the following code in it:

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" Inherits="Umbraco.Web.UI.Umbraco.Masterpages.Default" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    </asp:Content>
    

    When loading up the Main Site, I get a Blank Page. Umbraco.config was changed to WebForms yesterday, so the recycling of the Application Pool should be fine I would think. Is there something else I am missing here? I just get Blank Page, how to debug this?

    Basically, I created new Template:

    Name = HomeTemplate
    Alias = TemplateHome
    Master = none
    

    Put in the following code above. How do I load up my Master.Master file to include TemplateHome.aspx and TemplateHome.aspx.cs?

  • Sören Deger 733 posts 2844 karma points c-trib
    Oct 23, 2014 @ 20:51
    Sören Deger
    0

    Hi Solomon,

    it is normal if you get a blank page in frontend with the code above. You have no html code inside the ContentPlaceHolderDefault which can be rendered. Do you have at least one node in content section? Do you have assign the home template to your content node and have published this node after assign?

    Sören

  • Sören Deger 733 posts 2844 karma points c-trib
    Oct 23, 2014 @ 20:54
    Sören Deger
    0

    It's a long time ago when I was working with WebForms. I work only with MVC since Umbraco 7.1 is out. But the procedure with WebForms is exactly the same as before in Umbraco 4.

  • Solomon Closson 22 posts 42 karma points
    Oct 23, 2014 @ 20:57
    Solomon Closson
    0

    Do you have at least one node in content section?

    Yes, it is using the Home Document Type that I created.

    Do you have assign the home template to your content node and have published this node after assign?

    Yes Again.

    How to load up the Master.Master file into the Content element ContentPlaceHolderDefault? Or bypass this template thing altogether and just load up the Master.Master file instead?

  • Solomon Closson 22 posts 42 karma points
    Oct 23, 2014 @ 21:05
    Solomon Closson
    0

    Now, I just tried to put something in between the <Content /> element, like this:

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" Inherits="Umbraco.Web.UI.Umbraco.Masterpages.Default" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    Hello World.
    </asp:Content>
    

    And now getting a 404, Template Not Found Error. Went back to republish the Homepage, and reload the Homepage, and still get Template Not Found 404 Error, this page is intentionally left ugly... etc. etc.

  • Solomon Closson 22 posts 42 karma points
    Oct 23, 2014 @ 21:29
    Solomon Closson
    0

    I have been battling with this for 2 days now. Anyone out there can help please?

Please Sign in or register to post replies

Write your reply to:

Draft