开发者

what is the best naming convention for a user control?" e.g. id="LblUserName", id="LabelUserName", or id="UserNameLabel"? [closed]

开发者_运维问答 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

what is the best way to call my controls?

LblUserName or LabelUserName or UserNameLabel


For naming convention of a web control i usually follow this Convention
The reasoning behind this is that when using Intellisnse, you will be able to see your controls grouped together due to the first letters. So when typing "lbl" you will see all your Label controls, etc...


Its up to you really and what are you used to, just be consistent whit naming. I name my controls like:

lblUsername, txtAddress, btnSave, chbRemeberMe, cmbCategory...

After some time you may not remember how and why you called something the way you did. But you may know that you are looking for textbox or button. Since we read from left to right, i think this way is better, more organised and easier to find controls.


LblUserName is better way to call controls.


General convention is to use lblUserName or txtUserName. Note the lowercase first letter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜