1

Possible Duplicate:
What are the naming guidelines for ASP.NET controls?

Is there a standard guidelines as to the naming convention/style that asp.net control elements should be named. I have seen some developers prefixing textboxes with txt etc. Are there any standards that should be abided by?

Community
  • 1
  • 1
amateur
  • 43,371
  • 65
  • 192
  • 320
  • 1
    There are already lots of identical/similar questions. See the "Linked" and "Related" lists on the right. – M4N Jan 20 '12 at 12:08
  • 1
    [Best practices for C# GUI naming conventions?] [1]: http://stackoverflow.com/questions/1246546/best-practices-for-c-sharp-gui-naming-conventions – Anwar Jan 20 '12 at 12:10

4 Answers4

2

You can use ISO standard Naming convention or CMM level convention.

like Function name "Add"

variable name "strQuery"

Control Name "btnSubmit"

Class Name "Common"

Namespace "Sanjog.Web"

public Property Name "UniqueId"

private variable "_uniqueId"

Hope this is what you are looking for.

Amar Palsapure
  • 9,590
  • 1
  • 27
  • 46
0

MSDN has it covered -> MSDN Naming Guidelines

(follows an abstract from the linked page, too long to bring everything over)

Use the following three conventions for capitalizing identifiers.

Pascal case - The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters.

For example: BackColor

Camel case - The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized.

For example: backColor

Uppercase - All letters in the identifier are capitalized. Use this convention only for identifiers that consist of two or fewer letters.

For example: System.IO, System.Web.UI

You might also have to capitalize identifiers to maintain compatibility with existing, unmanaged symbol schemes, where all uppercase characters are often used for enumerations and constant values. In general, these symbols should not be visible outside of the assembly that uses them.

Anyway, as long as everyone working on a project follows the same convention, you're good to go, whatever that convention is.

Alex
  • 23,004
  • 4
  • 39
  • 73
0

Prefixes like "txt" are more common with developers who came up through VB6, or learned from developers who came up through VB6. In a truly object-oriented environment such as .NET its not as necessary to prefix items to indicate their type. However, doing so it entirely a matter of personal preference, just be consistent.

Michael Itzoe
  • 1,949
  • 4
  • 29
  • 49
0

There is no official standard for naming of controls. Actually the naming convention is only for your convenience so that it can be reusable and some one who will be editing it or trying to understand it would not be a big deal for him

Now coming to the point Generally Naming conventions are followed in company level

i.e some use the prefix of textbox (like textBoxName , textBoxPassword), some txt ( like txtName). Everything is right . It is just that all the developers in a team must follow the same and the same to be maintained through out the project.

mR.idiOt
  • 107
  • 2
  • 9