Rendering ASP.NET C# CompositeControls and web controls with a tag such as a DIV instead of a SPAN tag.
I've recently had a problem with an ASP.NET composite control where I'd added some specific styles directly to the control.
Weirdly .NET (4.6.2 in this case) would take the styles from the SPAN tag of the CompositeControl and apply them to the panels that these custom controls were in.
Very strange.
The simplest solution is to change the SPAN tag emitted by the CompositeControl to a DIV tag.
This can be done by overriding the TagKey property.
/// <summary>
/// Gets the
tag key for the control.
/// </summary>
protected override HtmlTextWriterTag TagKey
{
get { return HtmlTextWriterTag.Div; }
}
Comments
Post a Comment