i am programatically adding Webcontrols in to a User Control i am also adding a javascript event passing the controlID as a parameter but the clientID is the one i assigned a it does not contain the one that asp.net generates
var txt = new TextBox();
txt.ID = "MyID"+Number;
chkBox.Attributes.Add("onClick", "EnableTxtBox('" +txt.ClientID + "');");
i can workAround this by adding the parent control ID
chkBox.Attributes.Add("onClick", "EnableTxtBox('" + this.ClientID+"_"+txt.ClientID + "');");
On which Page life cycle are the Client IDs generated?