Asp.net name convention

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?
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

G

Guest

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?
 
Joined
Nov 29, 2010
Messages
1
Reaction score
0
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top