Is it possible to set the ClientID of any asp.net server control? How can I do this?
For VS 2010, .NET 4.0:
If you just try to set ctrl.ClientID="stringID" you will get an Error, saying that ClientID is read only. You can control the value of ClientID using ClientIDMode - which defines the algorithm with which ClientID is set:
ctrl.ID = "IDstring";
ctrl.ClientIDMode = ClientIDMode.Static; //ClientID value is set to the value of ID
The html markup will mark your control's html with the control's ID. Thus you have some degree of control from the code-behind.