Reputation: 981
I've created an asp.net webcontrol and I don't want it to render the ID="" attribute at all on the client side. How do I do this?
I've noticed that if I do this it doesn't render the ID="":
<tag:Name runat="server"/>
Output: <span />
If however I do this I get the ID:
<tag:Name ID="ABC" server=""/>
Output: <span ID="ABC" />
I'm not concerned with the "Content_ctl00" text, I just don't want the ID attribute rendered at all.
I'm assuming this can be done in either Render or RenderContents, I just don't know how to do it.
Edit: I don't need the ID attribute on either the client or the server side. If its supplied in the aspx page I want it ignored and not rendered (it can be dropped server side).
Upvotes: 0
Views: 834
Reputation: 981
This did the job:
protected override void Render(HtmlTextWriter writer)
{
ID = null;
base.Render(writer);
}
Upvotes: 1