views:

50

answers:

1

I am writing various ASP.NET Server controls and am needing to remove the tags that wrap my control by default. I am aware that you can change the tag to a different tag (as in this question, http://stackoverflow.com/questions/1084311/how-do-i-change-the-render-behavior-of-my-custom-control-from-being-a-span) but how can you prevent it?

I am inheriting from WebControl (can also inherit from CompositeControl).

I typically get:

<span>Control output</span>

I need:

Control output

I am overriding RenderContents(HtmlTextWriter output) and the CreateChildControls() methods (across various controls). My immediate need is to address the issue using the RenderContents(HtmlTextWriter output) method.

+1  A: 

What about this?

    public override void RenderBeginTag(HtmlTextWriter writer)
    {
        writer.Write("");
    }

    public override void RenderEndTag(HtmlTextWriter writer)
    {
        writer.Write("");
    }
Claudio Redi
Far too obvious! Thanks for your help.
Program.X