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

Forums / Bugs & Issues / sfContentBlock padding issue

sfContentBlock padding issue

21 posts, 0 answered
  1. SVA Webmaster
    SVA Webmaster avatar
    85 posts
    Registered:
    18 Jul 2007
    21 Dec 2011
    Link to this post
    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?
  2. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    22 Dec 2011
    Link to this post
    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
  3. SVA Webmaster
    SVA Webmaster avatar
    85 posts
    Registered:
    18 Jul 2007
    22 Dec 2011
    Link to this post
    Interesting... I'll give it a shot. Thanks, Sean!
  4. SVA Webmaster
    SVA Webmaster avatar
    85 posts
    Registered:
    18 Jul 2007
    22 Dec 2011
    Link to this post
    It worked, Sean. Thanks. Now if only the native contentblock control didn't unnecessarily render a <br/>!
  5. Amir
    Amir avatar
    33 posts
    Registered:
    24 Dec 2010
    23 Dec 2011
    Link to this post
    @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.
  6. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    26 Dec 2011
    Link to this post
    @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...


  7. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    26 Dec 2011
    Link to this post
    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
  8. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    06 Jan 2012
    Link to this post
    Sean, Just want to thank you for that invaluable post!
  9. Basem
    Basem avatar
    131 posts
    Registered:
    22 Dec 2010
    11 Jan 2012
    Link to this post
    I would hate to override a template for this, so I ended up applying a jQuery hack:

    $(".sfContentBlock > br:last-child").remove();

  10. JH
    JH avatar
    33 posts
    Registered:
    24 Nov 2010
    19 Jan 2012
    Link to this post
    Hi Basem,

    I would like to use your jquery method.
    where/how would I add to my page?

    Thanks,
    JH
  11. Basem
    Basem avatar
    131 posts
    Registered:
    22 Dec 2010
    19 Jan 2012
    Link to this post
    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.
  12. JH
    JH avatar
    33 posts
    Registered:
    24 Nov 2010
    19 Jan 2012
    Link to this post
    Basem,
    It works. 

    Thanks,
    JH
  13. Sylvie
    Sylvie avatar
    4 posts
    Registered:
    09 Jan 2012
    20 Jan 2012
    Link to this post
    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...)
  14. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    24 Jan 2012
    Link to this post
    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
  15. Sylvie
    Sylvie avatar
    4 posts
    Registered:
    09 Jan 2012
    24 Jan 2012
    Link to this post
    Hello Lubomir,
    OK, I asked my developer to recycle the app pool, and it doesn't change anything...
  16. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    26 Jan 2012
    Link to this post
    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,
    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
  17. Sylvie
    Sylvie avatar
    4 posts
    Registered:
    09 Jan 2012
    26 Jan 2012
    Link to this post
    Hi,
    Someone helped me via support ticket :)
    Thank you anyway!
  18. Maria
    Maria avatar
    2 posts
    Registered:
    07 Jul 2011
    13 Feb 2012
    Link to this post
    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."
  19. Pierre Alain
    Pierre Alain avatar
    38 posts
    Registered:
    10 Jun 2008
    08 Mar 2012
    Link to this post
    The br tag is still there in Sitefinity 5.0
  20. Pierre Alain
    Pierre Alain avatar
    38 posts
    Registered:
    10 Jun 2008
    08 Mar 2012
    Link to this post
    This is still a problem in 5.0
  21. Ben
    Ben avatar
    44 posts
    Registered:
    27 Sep 2012
    11 Apr 2012
    Link to this post
    Thanks Basem, this is still a problem in 5.0 so your code worked for me.
21 posts, 0 answered