<p>I'm an Information Architect and JavaScript developer by trade nowadays, but recently I've been getting back into back-end coding again.  And, whilst trying to get an HTML prototype integrated and working with our C#-based CMS, I've come to blows with our programmers over the HTML ID attributes being arbitrarily rewritten by .NET for form elements.</p>

<p>I can understand the code-behind reasoning for .NET changing IDs, but the fact you can no longer use IDs when trying to develop e.g. jQuery enhanced interfaces is causing some friction.  What can I do to work around this?</p>

<p>I've tried using the class attribute instead, but that's really crappy, not what it's meant for and doesn't get around that problem of .NET effectively changing rendered source on the fly.  It also means that CSS is less useful now and less efficient to create and maintain.</p>

<p>Any tips or advice greatly appreciated--anything for a few less sleepless nights...</p>

You can extend .net controls and make them return actual id's when related properties are called.
ClientID is the id attribute and UniqueID is the name attribute of html elements. So when you create a textbox like the following and using this instead of the textbox in framework, you make id and name attributes render as the same as the server-side id.
```
```
public class MyTextBox : TextBox
{
    public override string ClientID { get { return ID; } }
    public override string UniqueID { get { return ID; } }
}
```
```
To use this new user control, basically register this control as you would do for a custom user control (you can do is in web.config so you won't have to do it in all your pages):
```
```
<%@ Register Assembly="MyLibrary" NameSpace="MyLibrary.WebControls" TagPrefix="MyPrefix" %>
```
```
And use it like you would use a text box:
```
```
<MyPrefix:MyTextBox ID="sampleTextBox" runat="server" />
```
```