Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Under what circumstances will the ctl00 prefix render as something else ex. ctl01?

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?

like image 390
Biff MaGriff Avatar asked Sep 05 '12 22:09

Biff MaGriff


2 Answers

First of all 'ctlxx' is prefix of control's master page.

enter image description here

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.

like image 64
Parag Meshram Avatar answered Nov 14 '22 00:11

Parag Meshram


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 :/

like image 28
Debura Avatar answered Nov 13 '22 23:11

Debura