This happens because your control is a subclass of UserControl
class, which implements INamingContainer
interface. By default all controls that implement this interface prepend children's IDs with their own IDs, thus insuring that every ID on the page is unique.
To aviod this behavior you have two options:
Create server control, inheriting not from
UserControl
but fromControl
class directly. This one does not implementINamingContainer
. However you won't have markup file, and have to generate all controls programmatically.[Edit: ASP.NET 4 only] Use
ClientIDMode="Static"
for child controls. This mode insures that server and client IDs of the control are exactly the same. In this case this is a job of a developer to make sure that this control is used only once on the page to avoid ID duplicates.