Asp.net name convention

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?bmt3?=

    Asp.net name convention

    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?
  • Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

    #2
    Re: Asp.net name convention

    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:


    Here are Microsoft's recommended naming conventions:
    Use general naming conventions relating to word choice, guidelines on using abbreviations and acronyms, and guidance on avoiding language-specific names.


    And here's more info about Pascal case and Camel case:
    Apply capitalization conventions for identifiers, compound words, and common terms. Understand how case sensitivity works in .NET.


    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider



    "nkw" <nkw@discussion s.microsoft.com wrote in message
    news:72D946DD-2035-400A-808C-8E4647A2B462@mi crosoft.com...
    >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?

    Comment

    • =?Utf-8?B?bmt3?=

      #3
      Re: Asp.net 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 "txtFirstNa me"
      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, MVP, CSM, ASP Inside" wrote:
      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:

      >
      Here are Microsoft's recommended naming conventions:
      Use general naming conventions relating to word choice, guidelines on using abbreviations and acronyms, and guidance on avoiding language-specific names.

      >
      And here's more info about Pascal case and Camel case:
      Apply capitalization conventions for identifiers, compound words, and common terms. Understand how case sensitivity works in .NET.

      >
      --
      I hope this helps,
      Steve C. Orr,
      MCSD, MVP, CSM, ASPInsider

      >
      >
      "nkw" <nkw@discussion s.microsoft.com wrote in message
      news:72D946DD-2035-400A-808C-8E4647A2B462@mi crosoft.com...
      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?
      >

      Comment

      Working...