Asp.net name convention

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I usually name the controls as txtSomething, ddlSomething, gvSomething.
However, the FXCop indicate it's an error and Pascal convention is preferred.
Any good suggesion on ASP.Net control name convention?
 
Thanks. I following the rules for C# classes. However,

From the first link:

"For these reasons the vast majority of developers no longer need or use
Hungarian Notation. Those that do still use it tend to use it only to prefix
standard controls, so you might still see something like "txtFirstName"
around the net here and there."

For example, when build an asp.net page with a gridview for customer, you
may have a gridview, object data source, etc for customers. How to name them
if not have any meta type string for the control name?

Steve C. Orr [MCSD said:
It looks like you're still using Hungarian Notation. That's considered
rather old fashioned these days.
I've covered the details about why it's no longer recommended here:
http://SteveOrr.net/faq/HungarianNotation.aspx

Here are Microsoft's recommended naming conventions:
http://msdn2.microsoft.com/en-us/library/ms229045.aspx

And here's more info about Pascal case and Camel case:
http://msdn2.microsoft.com/en-us/library/ms229043.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


nkw said:
I usually name the controls as txtSomething, ddlSomething, gvSomething.
However, the FXCop indicate it's an error and Pascal convention is
preferred.
Any good suggesion on ASP.Net control name convention?
 
Hosting Reviews

Iam a linux reseller and i had one with netnames.net it but unlimitedgb.com's hosting is very nice and i don't have any issues till now.
 
Back
Top