How to set WrapperTag in Sitefinty Widget
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
Can anyone help on this?
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
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
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;
Hi Ivan Eftimov,
Thanks you Ivan. It works. Now my custom widget is rendered in a div.
Regards,
Prateek