I programmatically add Webcontrols to a user control. I also add a javascript event that passes the controlID as a parameter, but the client ID - the one I assigned to it does not contain the one that asp.net emits
var txt = new TextBox();
txt.ID = "MyID"+Number;
chkBox.Attributes.Add("onClick", "EnableTxtBox('" +txt.ClientID + "');");
I can work around this by adding a parent control id
chkBox.Attributes.Add("onClick", "EnableTxtBox('" + this.ClientID+"_"+txt.ClientID + "');");
On what page life cycle are client identifiers generated?
source
share