I know that in the next version of ASP.NET we\'ll finally be able to set the clientids on System.Web controls without the framework doing it for us in a quasi-intelligent wa
What I tend to do is dynamically generate javascript methods which handle this. You can do this in markup or code behind so for example:
You can also build the functions in the code behind and register them.
EDIT
A couple months ago I needed to fix the id of some server controls, I managed to hack it in and I described my method here here.
Basically you need put the controls inside a naming container like a user control, and then override a couple of properties which prevents the child controls from getting their uniqueid.