Content PlaceHolder Bug

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

Content PlaceHolder Bug

All Replies

Posted by Community Admin on 09-Dec-2010 00:00

I created a custom master page and uploaded it in Sitefinity.  When I wrap a content placeholder in a "p" tag Sitefinity doesn't actually render the content between the tags.  The content gets rendered below the end "p" tag. 

So

<p>
   <asp:ContentPlaceHolder ID="Content" runat="server" />
</p>

end up as

<p>
</p>
Content gets rendered here

I change the p to a div and it works as expected.  Is there a place to submit bugs?  Or view submitted bugs so I'm not spending time on already submitted bugs?

Posted by Community Admin on 11-Dec-2010 00:00

Hi Shawn,

All Sitefinity controls render at least one wrapping DIV around the content they display. So the HTML from your example is supposed to look like the one below.

<p>
<div>Content</div>
</p>

This markup is invalid, because P tags cannot contain DIV tags. I suppose you use Firebug to inspect the rendered HTML. So, because the HTML is invalid, Firebug applies its error algorithms to the HTML before displaying it. After the error algorithms are applied, the result is:

<p></p>
<div>Content</div>

If you open page source, you will see that the HTML is rendered as expected.

The second case you have mentioned renders DIV in DIV which is valid HTML and Firebug displays it as expected.

<div>
<div>Content</div>
</div>

You can remove the P tag from the masterpage and set it in the page. This will produce valid HTML.

Let us know if you need further help.

Regards,
Katia
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

Posted by Community Admin on 13-Dec-2010 00:00

Hi Katia,

Thanks for the info.  I guess the root issue goes back to the fact the Sitefinity is wrapping my Content Block in a div.  I wish there was a way to specify IF the Content Block gets wrapped in a div.  I've already started a long discussion that can be found here:  http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/content-block-template.aspx.

I actually would like

<p>
   <asp:ContentPlaceHolder ID="Content" runat="server" />
</p>

To render

<p>
Content
</p>

However, when I use the Content Block to add content to the placeholder it always gets wrapped in a div. 

<p>
<div>Content</div>
</p>

I've already created a custom control that provides the functionality I need but this is just another use case where the Content Block should have extended functionality where you can specify the begin/end tag. 

This thread is closed