DisplayAttribute Properties

Looking at the Display attribute, I find that using

<Display(Name:="Postcode", Order:=-9, _
           Prompt:="Enter suburb or postcode", Description:="Enter suburb or postcode")> _

Only name seems to work.
Is prompts and description supposed to work in MVC5.

Thanks

Hi ThatsIT,

Thanks for your post.

You set the order weight of the Name field to -9.The other fields in the entity have the default order weight of zero. Therefore, the Name field will be displayed first.Please check this:

http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.displayattribute.order(v=vs.110).aspx

And The Description property is typically used as a tooltip or description UI element that is bound to the member using this attribute. The Dynamic Data Edit.ascx template will display the description as a tooltip
in text-entry fields. A null value or empty string is valid.

http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.displayattribute.description(v=vs.110).aspx

This Prompt property is typically used as a prompt or watermark for a UI element that is bound to the property that is annotated with this attribute.

http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.displayattribute.prompt(v=vs.110).aspx

More information:

#DisplayAttribute “Prompt” or Watermark in Dynamic Data 4 (Visual Studio 2010 & .Net 4.0)

http://csharpbits.notaclue.net/2010/02/displayattribute-prompt-or-watermark-in.html

Hope this can be helpful.

Best Regards,

Eileen

Thanks, I know what they are, what I wanted to know, is if they work in MVC, or are they meant to work in MVC?

Thanks

ThatsIT

Thanks, I know what they are, what I wanted to know, is if they work in MVC, or are they meant to work in MVC?

Thanks

Yes.

Well there not working for me, is there something im missing?

Thanks

Leave a Reply