We are in the process of nutting out the design guidelines we would like to use in our development team and got into a discussion today around how ASP.NET controls should be named. I am talking about our good friends Label, TextBox, Button etc.
We came up with the following three possibilities that we voted on: (Example is a TextBox to enter/display a FirstName)
- Add the control type as a postfix to your controls ID: [FirstName
_
TextBox] or [FirstName_
tbx] - Add the control type as a prefix to your controls ID [tbxFirstName]
- Set the ID of the control to FirstName and name related fields (like a label for the textbox or a validator) as in option 2 [lblTextBox].
We ended up deciding to use option 2. It's not as verbose as option 1 and I like that it specifies what control it is before the name of the control.
My question is whether Microsoft has released any guidelines for these prefixes and or if you have any comments about our decision.