Placeholder in Root Layout using MVC

Posted by Community Admin on 04-Aug-2018 15:03

Placeholder in Root Layout using MVC

All Replies

Posted by Community Admin on 27-Jul-2016 00:00

     I am using MVC for my layout templates. I have placeholders in both the root and the nested templates. I am able to add content to the placeholders when creating a page. But when I view those pages the content is not inserted.

Here is an example of my templates.

Root.cshtml 

<html>
   <head>
   </head>
   <body>
      <div class="sfPublicWrapper" id="PublicWrapper">
          <div>
             @Html.SfPlaceHolder("TopNavigation")
         </div>
         @RenderBody()
         <div>
             @Html.SfPlaceHolder("Footer")
         </div>
      </div>
    </body>
</html>

Nested.cshtml

@
    Layout = "~/Mvc/Views/Shared/AssociateRoot.cshtml";
 
@Html.SfPlaceHolder("ModalContent")
 
@Html.SfPlaceHolder("InnerContent")
<div>More Content</div>

Any content put in the Footer placeholder or the navigation placeholder is not displayed. Any content placed in ModalContent or InnerContent does display. No errors are received that I can see.

Posted by Community Admin on 27-Jul-2016 00:00

Hi Jeff. Nesting and placeholders working really bad together. You can check similar thread: www.sitefinity.com/.../nested-layouts-not-working-with-section-helpers

This thread is closed