The prefix gets generated if the control lives inside another control which implements the INamingContainer interface. This is a marker interface whose sole purpose is to cause those prefixes to be put on the control IDs so that the control can be uniquely identified on the page.
If you need to get the appropriate id for use in script, use the Control.ClientID property to get the id. For example: <script> function DoSomething() { var id = <%= MyControl.ClientID %>; var obj = document.all("<%= MyControl.ClientID %>"); } </script> Either of the above should work to get you either the ID, or in IE, a reference to the object. HTH, Matt Milner BORN www.born.com -----Original Message----- From: Ian Smith To: [EMAIL PROTECTED] Sent: 5/24/02 4:32 AM Subject: [DOTNET] Web Form Control Ids - Prefix generation sometimes, not others??! In developing web form controls (ascx files) the control ids are usually generated as is (this is what the books show and the situation we have for most "sandpit" projects). ie if I have a form with a control called "TestDropDown" that is the id or name I see generated in the HTML at the client end. Two other projects working alongside our group reported that they were getting nasty prefixes which were messing up their client-side JavaScript (validation controls can't do everything). In IE all fields are prefixed with "_ctln_" where n is the sequence of the control. In Netscape they are prefixed with something similar (but different enough to make it a pain!) I assumed they were having problems down to having a beta installed originally or somesuch, but suddenly all our own code is now generating these control prefixes. Trouble is we can't work out how/what caused the change! Does anyone know what determines that these prefixes get generated. They make life more tiresome for client-side scripting. Is it the number of controls in a project or some setting somewhere? Thanks for any responses, Ian You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.