1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Embedded ContentPlaceHolder creates additional content region

Embedded ContentPlaceHolder creates additional content region

14 posts, 0 answered
  1. Ryan Dailey
    Ryan Dailey avatar
    41 posts
    Registered:
    08 Mar 2010
    02 Dec 2010
    Link to this post
    I have been moving our Sitefinity 3.7 site over to 4.0.  Our master pages are all based on a parent master page.  We have defined ContentPlaceHolders in the parent master page. In the child master page we have embedded additional ContentPlaceHolders under those placeholders.  When I create a template based on the child master page, it creates an additional content region at the bottom of the page, one for each ContentPlaceHolder in the child master page, as well as one for each ContentPlaceHolder in the parent.  This doesn't really feel like expected behavior, and seems to be confusing than helpful.  In my view, there should only content regions for ContentPlaceHolders defined directly in the master page the template is based on.  Is this going to be corrected in the release?
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    03 Dec 2010
    Link to this post
    Hi Ryan Dailey,

    Have you used the the migration tool, because it does not properly support nested master pages. Currently we are working on the multi language content and pages migration and the next item in the TODO list is nested master pages and more robust page controls migration. I expect this to happen by the middle of the next work week.

    If you have just transferred manually your templates to Sitefinity 4.0, then all ContentPlaceHolders defined in the root master are inherited by the child master pages ( nested pages ). It would be helpful if you can attach several screenshots that illustrate the issue you have and share with us why inhering all ContentPlaceHolder recursively from the top master page would be an issue, since you are nesting all templates.

    Best wishes,
    Lubo
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Ryan Dailey
    Ryan Dailey avatar
    41 posts
    Registered:
    08 Mar 2010
    03 Dec 2010
    Link to this post
    Here is the code.  Body.master has two ContentPlaceHolders defined, but when used in Sitefinity, it thinks there are three.  It seems to be because of the ContentPlaceHolder defined in Blank.master, of which of course the other ContentPlaceHolders are nested inside.

    Blank.master (Parent):
    <%@ Master Language="C#" AutoEventWireup="true" Inherits="Blank" Codebehind="Blank.master.cs" %>
    <%@ Register TagPrefix="HC" TagName="PageHeader" Src="~/UserControls/Navigation/PageHeader.ascx" %>
    <%@ Register TagPrefix="HC" TagName="PageFooter" Src="~/UserControls/Navigation/PageFooter.ascx" %>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <head runat="server">
        <title></title>
        <style>
          
        .Content 
        {
            /*background-color: #E0E0E0;*/
            background-color: #F0F0F0;
        }
          
        </style>
        <asp:ContentPlaceHolder id="Head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body style="margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; height: 100%; background-color: #252525;">
        <form id="form1" runat="server">
        <div>
              
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
              
            <div style="background-color: #252525; padding-top: 10px; padding-bottom: 10px; border-bottom: #8A8987; border-width: 1px; border-style: solid;">
                <div style="margin: 0 auto; width: 976px; padding-left: 0px; padding-right: 0px;">
                    <HC:PageHeader ID="pageHeader" runat="server" />
                </div>
            </div>
              
            <div style="background-image: url( '/internetsite/images/redbackground.jpg' ); background-repeat: repeat-x; background-color: #DC0411;">
                <div class="Content" style="margin: 0 auto; width: 976px;">
                    <asp:ContentPlaceHolder ID="Content" runat="server" />
                </div>
            </div>
      
            <div style="background-color: #252525; padding-left: 10px; padding-top: 0px; padding-right: 10px; padding-bottom: 10px; border-top: 1px solid #8A8987; height: 100%;">
                <div style="margin: 0 auto; width: 976px; height: 100%;">
                    <HC:PageFooter ID="pageFooter" runat="server" />
                </div>
            </div>
      
        </div>
        </form>
    </body>
    </html>

    Body.master (child):
    <%@ Master Language="C#" AutoEventWireup="true" MasterPageFile="~/App_Master/Blank.master" Inherits="App_Master_body" Codebehind="Body.master.cs" %>
      
    <asp:Content ID="Style" runat="server" ContentPlaceHolderID="Head">
      
        <style>
          
        .Content 
        {
            /*background-color: #E0E0E0;*/
            background-color: #F0F0F0;
        }
          
        </style>
      
    </asp:Content>
      
    <asp:Content ID="content" runat="server" ContentPlaceHolderID="Content">
      
        <div style="padding-top: 25px; padding-bottom: 25px; padding-left: 25px; padding-right: 25px;">
      
            <div class="BreadcrumbTrailAndPageTitleArea">
            <asp:ContentPlaceHolder ID="BreadcrumbTrailAndPageTitleArea" runat="server" />
            </div>
      
            <div class="Body">
            <asp:ContentPlaceHolder ID="BodyColumn" runat="server" />
            </div>
      
        </div>
          
    </asp:Content>

  4. Ryan Dailey
    Ryan Dailey avatar
    41 posts
    Registered:
    08 Mar 2010
    03 Dec 2010
    Link to this post
    You also asked for a few screenshots.  So I am providing those as well.

    What seems to makes it most confusing is that the parent's placeholder is being shown at the bottom in the designer, but displays properly at the top in the preview.  The child placeholders are actually contained in this placeholder.

    The fact that the child master page is actually using this placeholder for content, as well as definining other placeholders, in my mind it doesn't leave much reason for the the parent placeholder to be visible in the designer.  If this is intended behavior, then it is making assumptions on the how the master page is being used.  In my case, the parent placeholder should not visible.
  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    09 Dec 2010
    Link to this post
    Hi Ryan Dailey,

    Thank you for providing detailed information about your problem.

    This currently is an issue with parsing content place holders coming from the parent master page. We are aware of this issue and are struggling to resolve it. As a workaround we would recommend that you use the templates, and create page templates which inherit from other templates (without using master page files a a base). Or have a parent base master page file and create templates which inherit from it, but extend them with additional place holders.

    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Ryan Dailey
    Ryan Dailey avatar
    41 posts
    Registered:
    08 Mar 2010
    09 Dec 2010
    Link to this post
    Okay, thank you for looking into this.
  7. MB
    MB avatar
    302 posts
    Registered:
    09 Jan 2005
    11 Dec 2010
    Link to this post
    I too have a design using nested Masterpages, with custom code-behind at each level, and have struggled to see how I can implement a satisfactory workaround using the Sitefinity layout editor as a replacement for creating templates based directly on nested masterpages.

    I don't know if my view of this is the same as everyone elses, but I'd be interested to know if Sitefinity is intended to address my needs and Telerik just needs more time to work on it, or if I need to totally rethink my design.

    Essentially, I would require that the template editor emulate the way the VisualStudio designers works, only making available for editing, the contentplaceholders from the masterpage the template was directly created from, while any contentplaceholders on parent masterpages should be read-only areas, displaying their nested content.

    e.g. MasterPageA contains 2 contentplaceholders
           MasterPageB contains 4 contentplaceholders
           MastePageB is nested in MasterPageA using one its 2 contentplaceholders.

    If I create 2 templates, TemplateA and TemplateB, based on MasterPageA and MasterPageB respectively, then when editing the templates in Sitefinity:

    Editing TemplateA:  I would expect to see 2 editable content areas (so I can customise the base template with common content)

    Editing TemplateB:  I would expect to see 4 editable content areas, and 2 read-only content areas (i.e. the 2 from TemplateA) that are displaying content added to them at a lower editing level.

    Is this basically how it's intended to work ?
  8. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    15 Dec 2010
    Link to this post
    Hi MB,

    In Sitefinity 4.0 the intend it to move away from having physical files as a whole. This is why we have managed to perfect the approach when working without physical master pages as a whole. This way the template editor works as expected when used with templates only.

    Currently there are some glitches when working with nested master pages, however we are not able to fix those in the weekly build as there are more pressing bugs to be resolved. Right now what works is that if you create a parent master page and create it for example with only one content place holder, and create a child master page with place holders using the parent one and finally create a template from the child master page you will see control place holders only from the child master page.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. MB
    MB avatar
    302 posts
    Registered:
    09 Jan 2005
    16 Dec 2010
    Link to this post
    The template editor is nice, but (unless I'm missing the point) it would not seem to provide the same level of control as using masterpages.

    e.g. My masterpages use custom code on standard ASP.NET events, and even override some of those using a custom base class... how would I implement that using just the template editor ?
  10. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Dec 2010
    Link to this post
    Hi MB,

    Thank you for getting back to me.

    We are aiming to completely remove the need for physical master files, and we will get there soon enough. However currently the common code which runs on init event has to be added in a physical one. So you can have one parent master page with the initialization code and create child templates which inherit from this base master page.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Systeembeheer UNIT4
    Systeembeheer UNIT4 avatar
    12 posts
    Registered:
    17 Nov 2008
    12 Apr 2011
    Link to this post
    I'm facing the same problem. I tried to implement the strategy as described above, but in the page editor I can still see the contentplaceholder from my Base.master.

    What I did is the following. First I've creates the base.master with only one contentplaceholder. Here's the code:
    <body>
        <form id="form1" runat="server">
            <div class="container">
                <KNLTB:Header ID="Header1" runat="server"></KNLTB:Header>

                <div class="content-container">
                <KNLTB:SubHeader ID="SubHeader1" runat="server"></KNLTB:SubHeader>
                <div class="content-repeater">
                    <div class="content-top">
                        <div class="content">
                            <div class="wrapper">
                                <asp:ContentPlaceHolder ID="ContentPlaceHolderBase" runat="server" />
                            </div>
                       
                            <hr class="l12-12" />
                        </div>                
                    </div>
                    </div>
                    <div class="content-bot">&nbsp;</div>
                </div>
                <div class="paperclips"></div>
                <div class="potlood"></div>
                <div class="gum"></div>
            </div>
        </form>
    </body>

    Next I created a TwoColumns.master with two contentplaceholders. The code again:
    <asp:Content ID="ContentBase" ContentPlaceHolderID="ContentPlaceHolderBase" runat="server">
        <div class="grid12-8">
            <asp:ContentPlaceHolder ID="ContentPlaceHolderLeft" runat="server" />
        </div>
        <div class="grid12-4 pt20">
            <asp:ContentPlaceHolder ID="ContentPlaceHolderRight" runat="server" />
        </div>
    </asp:Content>

    Now I went to the backend from sitefinity and I've created a new template that is based on TwoColumns.master. When I can edit the template content I can see placeholder. When I publish the template and I create a page that is based on that template, I also see 3 placeholder when designing the page. What am I doing wrong?

    I'm working with sitefinity version 4.0.1210.0

    Kind Regards,

    Mark

  12. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    17 Apr 2011
    Link to this post
    Hello Systeembeheer UNIT4,

    Unfortunately at the moment this is how the template parser behaves. You can limit the extra place holder by applying permissions to it so that it is not seen by non administrative users.

    Greetings,
    Radoslav Georgiev
    the Telerik team

  13. Systeembeheer UNIT4
    Systeembeheer UNIT4 avatar
    12 posts
    Registered:
    17 Nov 2008
    18 Apr 2011
    Link to this post
    Since I am a beginner with sitefinity, could you tell me how I can set this up. I,ve tried to look at the template in the backend, but there I don't have the option to set the permissions on a placeholder. So, I guess I have to do this in code. So could you provide a snippet or something.
  14. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    21 Apr 2011
    Link to this post
    Hi Systeembeheer UNIT4,

    Place a layout control in the xtra place holder. Click the More button and go to permissions. From there edit the permissions.

    Kind regards,
    Radoslav Georgiev
    the Telerik team

14 posts, 0 answered