Last post Sep 01, 2008 08:00 AM by bhav27
Aug 30, 2008 03:57 PM|bhav27|LINK
By default composite controls render inside SPAN tag.
Like custom controls derived from WebControl can be rendered inside any choose HTML tag, is it same possible for custom controls derived from CompositeControl?
Aug 31, 2008 03:30 AM|Jos Branders|LINK
Try adding this code (I'm using VB.NET):
Protected Overrides ReadOnly Property TagKey() As System.Web.UI.HtmlTextWriterTag
This is also better for W3C validation.
Aug 31, 2008 11:11 PM|Peter Bucher|LINK
There are two ways:
1. Override TagKey as Jos described
2. Put the TagKey in the base constructor
Its also possible to override RenderBegin- and RenderEndTag, but the two ways shown above are the best and cleanly ones.
Sep 01, 2008 08:00 AM|bhav27|LINK
I found what Jos says useful. However you cannot put TagKey in the base contructor when you derive your custom control from compositecontrol. This can be achived when deriving from WebControl.