sfContentBlock padding issue - Bugs & Issues - Bugs & Issues - Progress Community
 Bugs & Issues

sfContentBlock padding issue

  • 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,

    I am guessing you were seeing what we were which is that now the ContentBlock is now adding a <br /> tag at the bottom?

    If you want to get rid of the BR tag you can need to override the ControlTemplate for the ContentBlock.

    Create your Custom Template at say ~/Custom/Views/ContentBlock.ascx, the original looks like this (note the br which you can remove at this point):

    <%@ 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>

    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)

    Recycle your application and now you should have no br tag anymore...

    Edit: If you want to achieve the same thing for Page Templates to you can also add a new View Map following the same instructions above except set the HostType to  Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlockBase.

    Cheers
    Sean
  • 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,

    Where can I determine the original layout as you've explained, for other controls?  I've often wanted to override the controls, but always have a difficult time finding the original control definition.  Also, is there a list of the namespaces for the existing controls somewhere?

    btw, the solution worked perfectly... It's unbelievable that this issue passed QA in the first place.
  • @Amir,

    I use JustDecompile (free) to get the resources, all the Ascx templates can be found in the Sitefinity.Resources.dll.

    As for the Namespaces again I usually use JustDecompile but it takes quite a lot of looking around before you can figure out the standard namespaces that Telerik use, but after a while you get the hang of it.

    It is unusual of Telerik to miss something so obvious, I suspect it was a last minute added thing...


  • 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,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • 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
  • 329476_ScreenShot008.png
    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,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items