Can sfimageWrp be removed? - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Can sfimageWrp be removed?

  • Can sfimageWrp be removed?
  • 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.
  • 340263_special-characters.png
    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...

  • 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
  • Jen,
    That is exactly what I did and it works.  Thank you.