Sunday, January 22, 2006

ASP .NET Control Naming Conventions

Control NameExamplePrefix
LabellblNamelbl
TextBoxtxtNametxt
GridViewgvResultgv
ButtonbtnSavebtn
ImageButtonibtnSaveibtn
HyperlinklnkHomePagelnk
DropDownListddlCompanyddl
ListBoxlstCompanylst
DataListdlstAddressdlst
RepeaterrepSectionrep
CheckboxchkMailListchk
CheckBoxListchkAddresschk
RadioButtonrdoSexrdo
RadioButtonListrdoAgeGrouprdo
ImageimgLogoimg
PanelpanSectionpan
PlaceHolderplhHeaderplh
CalendercalMyDatecal
AdrotatoradrBanneradr
TabletblResultstbl
[All]ValidatorsvalCreditCardNumberval
ValidationSummaryvalsErrorsvals

3 comments:

Anonymous said...

I prefer:
LabelName, TextBoxName, ButtonSave, ListBoxCompany, RadioButtonSex, ...

Why make your own and other people's (programming) life more complicated (and miserable) by using a slew of hard to remember and hard to decipher prefixes?

Kind regards,
Don Delegate

KD said...

Dear,

Thank you for comment.

Every time when we go to write entier control name it consume time. Standards are not mandatory for every body. But some people don't follow any standard naming conventions and in industry it become tedious to understand the code. (especially in team). Standards given by me are well known in industry. And with little typing practice easy to remember.
These standards are known as Hungarian Notations in IT industry. Many IT companies follow these standards. Even in MSDN these standard prefix are given for some controls.

Regards.

Kuldeep.

Anonymous said...

It's good to summarize the controls naming convention.
But What's the naming convention for ASP.NET 3.5 should use? Like FileUpload ETC...

Visitor Count: