While working with VS by default the editor generates this:
<asp:Button ID="Button1" runat="server" Text="Button" />
Now the ID generated is Button1 i.e First letter capital. My questions is what is the best way to name the controls ?
-
SubmitButton
-
btnSubmit
or something else?
Which naming convention is considered good ?
btnSubmitis Hungarian notation which I don’t personally consider good for UI programming since the type of control is evident directly through its declaration or intellisense in Visual Studio.SubmitButtonis better. Generally it takes a form –Purpose-TypeOfControlFor example
This is a good reference:
http://10rem.net/articles/net-naming-conventions-and-programming-standards—best-practices
Update: Hungarian notation is also discouraged by stylecop/Fxcop. So its better to not to use entirely.