When using an ASP.NET CheckBox (and in out case, inherited from a CheckBox) it renders a span around the checkbox input control, this span control
I don't know if this will work on this particular example. But if you make your own WebControl and you never want it to render spans around itself you can override the Controls render method like this:
public class MyWebControl : WebControl
{
/* Your code
between here */
protected override void Render(HtmlTextWriter writer)
{
RenderContents (writer);
}
}
I guess that you could add the same to an inherited CheckBox... something like this:
public class MyCheckBox : CheckBox
{
/* Your code
between here */
protected override void Render(HtmlTextWriter writer)
{
RenderContents (writer);
}
}
The basic problem with the solution is better explained here:
http://www.marten-online.com/net/stripping-span-tag-from-webcontrol.html