How to set WrapperTag in Sitefinty Widget

Posted by Community Admin on 04-Aug-2018 11:01

How to set WrapperTag in Sitefinty Widget

All Replies

Posted by Community Admin on 12-Jan-2015 00:00

Hello All,

 I am developing a custom Sitefinity widget using user control. 

After adding custom widget on Page I found that it is rendered in SPAN tag. I want to change that wrapper tag to DIV for maintaining HTML structure across the site.

 

I checked some inbuilt controls having WrapperTag property to set the wrapper tag of HTML. I also checked the SimpleView base case of widget but I cannot able to locate the WrapperTag property.

 

Please help me to set the wrapper element to Div instead of Span in custom widget.

 

Thanks in Advance,

Jaydeep Jadav

 

Posted by Community Admin on 23-Feb-2015 00:00

Can anyone help on this?

Posted by Community Admin on 26-Feb-2015 00:00

Hello,

I have tested the reported behavior with a User Control and in all cases, the control was rendered in a div and not a span. Would it be possible to clarify if on your end both user and custom controls get rendered in a span? What is the page template that you have configured for the page? Do you get the same behavior on a page without template?

Regards,
Atanas Valchev
Telerik

 
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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 26-Feb-2015 00:00

Hello,

Thanks for your support.

 

Yes, I am getting same behavior in With template and without template. It is always render in span tag. I used SimpleView / ascx custom widget.

 

Thanks,

Jaydeep Jadav

Posted by Community Admin on 02-Mar-2015 00:00

Hi Jaydeep,

In order to change the wrapping tag you should override the TagKey property of your widget. Through this property you have a variety of choices (not only div) for wrapping tag. Following is an example for setting a div as a wrapping tag:

protected override System.Web.UI.HtmlTextWriterTag TagKey
    get
    
         return System.Web.UI.HtmlTextWriterTag.Div;
    

Tell us if this works for you.

Regards,
Ivan Eftimov
Telerik
 
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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 07-Nov-2015 00:00

Hi Ivan Eftimov,

Thanks you Ivan. It works. Now my custom widget is rendered in a div.

Regards,
Prateek

This thread is closed