ASP.NET Controls: ClientID

If you are using a control hierarchy that implements INamingContainer, when the controls render to a browser the ID property (viewed from the html source) will not be the same as the ID you have set programatically (by doing myControl.ID, the ID will be prefixed). To overcome this, you can access the clientid property of a webcontrol (which gives you the id of a control as rendered to the browser).

Note that the clientid will not be correct if you try to obtain it before the control is added to the controls hierarchy.

See the following article for more details http://blog.steeleprice.net/archive/2004/04/12/209.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>