Introduction
Any reader of this article should have, at least once, looked at the source of an HTML page with a simple DataGrid
or a UserControl
and noticed the length of the 'id
' and 'name
' attributes. The purpose of this articles is to understand the "How?" and "Why?" of them sometimes being really long.
Background
These attributes are always unique, and therefore isn't a surprise saying that they are the visible face of the control server-side property called UniqueID
.
The Control
is the base class for all WebControl
s, and supplies three ID properties:
ID
- Which can be set by the programmer.UniqueID
- A generated read-only ID used for server-side and postdata management. This property renders the attribute 'name
'.ClientID
- A special read-only transformation of UniqueID
for client-side exclusive purposes. This property renders the attribute 'id
'.
A systemic analysis of Control
code shows that the ClientID
value is a UniqueID
value transformation, and this last one is a composition of its NamingContainer.ID
and its own ID.
This relation between properties shows us that it's possible to manage both 'id
' and 'name
' attributes through a simple manipulation of the server-side property ID of all the involved controls.
A potential problem
We should have in mind that almost all corporate ASP.NET solutions require high customization levels and therefore a reasonable number of composite custom controls. Those custom controls are heavily used and increase the parent hierarchy depth significantly. In addition, we cannot forget:
- that naming business entities isn't as simple as that;
- that a name that fully describes the intended functionality will substantially increase the readability and maintainability of code (are we ready to pay this price to simply minimize our pages size?);
- the amazing naming creativity that a programmer is capable of.
Over 13 years of experience in the Software Development working mainly in the banking and insurance industry.
Over 3 year of experience as Operations Team Leader focused on Infrastructure Management and Software Configuration Management.
I've been honored with the Microsoft Most Valuable Professional (MVP) Award for three consecutive years, 2010, 2011 and 2012, in recognition to exceptional technical contributions and leadership.
Current / Recent Technical Projects
- Dominican Republic Instance management, including 2nd line System management, capacity management, SW monitoring and deploy management
- Colombian SECOPII Instance management, including 2nd line System management, capacity management, SW monitoring and deploy management
- Vortal Main Instance management, including 2nd line System management, capacity management, SW monitoring and deploy management
- Vortal Development ecosystem management, including Server management, , capacity management, SW monitoring and deploy management
Areas of Specialization:
- Operations Management - ISO 20000 & ISO 27001 driven
- Team Management and Coaching
- Technology Leadership, Solutions/Architecture
- Product life cycle management, Continuous Integration
- Technological background in Microsoft frameworks and tools.