DataAnnotation显示月份名称

sum*_*dha 4 c# asp.net-mvc dataformat displayformat

如何在DataFormatString中显示完整的月份名称和年份?(2014年11月)

我尝试使用这个DataAnnotation,但它没有给我所需的o/p:

 [DisplayFormat(DataFormatString="0:MMMM-yyyy")]
Run Code Online (Sandbox Code Playgroud)

Son*_*nül 5

我不知道它有什么不同但是怎么样;

[DisplayFormat(DataFormatString = "{0:MMMM-yyyy}")]
Run Code Online (Sandbox Code Playgroud)

来自DisplayFormatAttribute.DataFormatString物业

格式化字符串可以是任何文字字符串,通常包含字段值的占位符.例如,在格式化字符串"Item Value:{0}"中,当字符串显示在DynamicField对象中时,字段的值将替换{0}占位符.格式化字符串的其余部分显示为文字文本.

如果格式字符串不包含占位符,则数据源中的字段值不会包含在最终显示文本中.