I've inherited an application that contains a ton of javascript with hardcoded client ids.
In the past when I did load testing I seem to remember that sometimes the generated client ID would start with ctl01.
Under what circumstances will this occur?
First of all 'ctlxx' is prefix of control's master page.
The ASP.NET engine sets the ID values at runtime for those controls whose IDs have not been explicitly set. It uses the naming pattern ctlXX, where XX is a sequentially increasing integer value. So, in case of nested master pages you will get prefix as ctlxx
where xx
will be incremented value.
Control's Id
value is prefixed with the master page's ID value, ctl00
. The net effect is an id attribute value consisting of the ID values of the master page
, the ContentPlaceHolder control, and the Control itself.
Conclusion -
So, only case when ctlxx
prefix will be altered is having nested master pages for a .aspx page.
Please refer Control ID Naming in Content Pages (C#) for more information.
I think it's an id created for every nested master page, you might want to test the theory by nesting and then seeing how the Ids look though, as I don't have the tools available where I am right now to provide the proof :/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With