DataAnnotation to display the name of the month

How can I display the full name of the month and year in a DataFormatString? (November-2014)

I tried using this DataAnnotation but it doesn't give me the o / p I want:

 [DisplayFormat(DataFormatString="0:MMMM-yyyy")]

      

+3


source to share


2 answers


I don't know if it matters or not, but how about:

[DisplayFormat(DataFormatString = "{0:MMMM-yyyy}")]

      



From DisplayFormatAttribute.DataFormatString

property

The formatting string can be any literal string and usually includes a placeholder for the field value. For example, in the formatting string "Item Value: {0}", the field value is replaced with {0} placeholder when the string is displayed in the DynamicField object. The rest of the formatting string is displayed as literal text.

If there is no placeholder in the formatting string, the value field from the data source is not included in the final display text.

+3


source


Missing brackets:



[DisplayFormat(DataFormatString="{0:MMMM-yyyy}")]

      

+2


source







All Articles