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

Forums / Designing & Styling / Can sfimageWrp be removed?

Can sfimageWrp be removed?

4 posts, 0 answered
  1. Mike
    Mike avatar
    2 posts
    Registered:
    09 Feb 2012
    01 Mar 2012
    Link to this post
    We have noticed when we add an Image content to a Page or PageTemplate it adds an extra div tag (see below)
    <div class="sfimageWrp">
    Is there a way to override this or not have the div class generated for images?
    We tried to remove the sfimageWrp fro the CssClass in the Image advanced properties, but it keeps adding it when the page html is generated.
  2. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    02 Mar 2012
    Link to this post
    Hey Mike,

    You can change the class to anything you'd like - but as soon as you remove it, it'll default back to 'sfimageWrp'. So unless you want to build your own custom control that doesn't put a <div> tag around an image, you're stuck with a class attribute...

    However, one must cheat where one can so have you tried to replace it in the widget with a zero length space? (yes that's an actual character) The screenshot is in Dutch but should give you a clue as to where to locate it...

    Jochem.
  3. Jen Peleva
    Jen Peleva avatar
    568 posts
    Registered:
    10 Nov 2016
    06 Mar 2012
    Link to this post
    Hey guys,

    There's something else you can do, though I have to admit that's a nice trick, @Jochem :). @Mike, you can create a custom Image widget, which inherits from the default one and in its code -behind simply override two methods - RedredBeginTag and RenderEndTag. This should be enough to remove the div. Take a look at the sample below:
    namespace SitefinityWebApp.Controls
    {
        public class ImageWidget: ImageControl
        {
            public override void RenderBeginTag(System.Web.UI.HtmlTextWriter writer)
            {
                if (!string.IsNullOrEmpty(this.CssClass))
                {
     
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
                   
                }
            }
     
            public override void RenderEndTag(System.Web.UI.HtmlTextWriter writer)
            {
                 
            }
        }
    }

    All the best,
    Jen Peleva
    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
  4. Mike
    Mike avatar
    2 posts
    Registered:
    09 Feb 2012
    06 Mar 2012
    Link to this post
    Jen,
    That is exactly what I did and it works.  Thank you.
4 posts, 0 answered