Search code examples
c#asp.net-mvcdata-annotationsdisplayattribute.net-attributes

displayname attribute vs display attribute


What is difference between DisplayName attribute and Display attribute in ASP.NET MVC?


Solution

  • They both give you the same results but the key difference I see is that you cannot specify a ResourceType in DisplayName attribute. For an example in MVC 2, you had to subclass the DisplayName attribute to provide resource via localization. Display attribute (new in MVC3 and .NET4) supports ResourceType overload as an "out of the box" property.