sfContentBlock padding issue
After upgrading to SF4.4 yesterday, it appears there is a 15px pad to the bottom of any div with a class of "sfContentBlock". I have verified this in Firebug. Is this a known issue and how can I work around it / override the class setting this?
Hi Craig,
<%@ Control Language="C#" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit"
Assembly="Telerik.Sitefinity" %>
<
asp:Literal
ID
=
"contentHtml"
runat
=
"server"
></
asp:Literal
>
<
sf:BrowseAndEditToolbar
ID
=
"browseAndEditToolbar"
runat
=
"server"
Mode
=
"Edit"
>
</
sf:BrowseAndEditToolbar
>
<
br
/>
<
asp:PlaceHolder
ID
=
"socialShareContainer"
runat
=
"server"
></
asp:PlaceHolder
>
Interesting... I'll give it a shot. Thanks, Sean!
It worked, Sean. Thanks. Now if only the native contentblock control didn't unnecessarily render a <br/>!
@Sean,
@Amir,
Hi all,
We are aware of the extra <br/> issue with content blocks. I'm not sure if we will have a hot fix for this or if this will be fixed in the next release. In all cases apologies for the inconvenience, I hope Sean's workaround works for the time being.
All the best,Sean, Just want to thank you for that invaluable post!
I would hate to override a template for this, so I ended up applying a jQuery hack:
$(
".sfContentBlock > br:last-child"
).remove();
Hi Basem,
I would like to use your jquery method.
where/how would I add to my page?
Thanks,
JH
From the admin, edit your page template. Then from the page toolbox on the right side, drag the Javascript control anywhere onto the page. Edit the widget and then you can put that script in there and have it load before the closing body tag.
Basem,
It works.
Thanks,
JH
Hi !
I created my ContentBlock.ascx and followed all of these steps :
In the Sitefinity Backend go to Administration -> Settings -> Advanced
Expand Controls -> ViewMap
Click "Create New"
HostType: Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock
LayoutTemplatePath :
~/Custom/Views/ContentBlock.ascx (or wherever you put one)
But when I use it, Sitefinity don't take my ascx. It is replaced by "Telerik.Sitefinity.Resources.Templates.Backend.GenericContent.ContentBlock.ascx"
(see screenshot in attach).
I can replaced it by mine and so it works. But I don't undestand why it doesn't work via the admin.
Help ? (and sorry for my bad english...)
Hello Sylvie,
After you created the mapping did you recycle the app pool? I'm not sure what I see on your screenshot, but if you created such a mapping the value in the LayoutTemplatePath will be ignored in favour of the mapped control.
All the best,Hello Lubomir,
OK, I asked my developer to recycle the app pool, and it doesn't change anything...
Hi Sylvie,
I tried the steps that Sean provided and it worked for me. I suppose you missed a step or did something wrong? Could you please check again if everything is set correctly?
Regards,Hi,
Someone helped me via support ticket :)
Thank you anyway!
For anyone else who tried Sean's solution but didn't realize why it wasn't working on template pages... this came from support and did the trick:
"Actually the Content block widgets are different for Page and PageTemplate, due to the shared content functionality that is supported only on Pages. In that line of reasoning, the widget dropped on pages is of type Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock while the one dropped on a template is Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlockBase. One option would be to add another ViewMap entry and map the customized template to ContentBlockBase as well, the other one would be to just edit the widget on the template and specify in its LayouttemplatePath property the relative path to your custom template. While the latter will work for a particular widget only, the first option will have the same effect - globally map the template for content blocks on templates."
The br tag is still there in Sitefinity 5.0
This is still a problem in 5.0
Thanks Basem, this is still a problem in 5.0 so your code worked for me.