Quantcast
Channel: FlexiCoder Blog » .Net code
Viewing all articles
Browse latest Browse all 10

Server Control Remove Span

$
0
0

Normally when you write a server control, .Net automatically wraps the output with a span and the Id of the control. Depending on your CSS this can cause rendering issues. You can use the following technique to prevent the span from being rendered.

public override void RenderBeginTag(HtmlTextWriter writer)
{
    using (HtmlTextWriter blankOne = new HtmlTextWriter(new System.IO.StringWriter()))
    {
        base.RenderBeginTag(blankOne);
    }
}
public override void RenderEndTag(HtmlTextWriter writer)
{
}

It basically writes out the open tag to a new HTML Writer and therefore is not part of the final rendered HTML


Viewing all articles
Browse latest Browse all 10

Trending Articles