C# DataAnnotations.DisplayFormat不';我似乎不支持列表。有办法避开它吗?

C# DataAnnotations.DisplayFormat不';我似乎不支持列表。有办法避开它吗?,c#,asp.net-mvc,C#,Asp.net Mvc,我有一个ASP.NET MVC应用程序,其模型具有以下属性: [DisplayFormat(DataFormatString = "{0:N1}", ApplyFormatInEditMode = true)] public List<decimal?> Scores { get; set; } 事实并非如此。不管怎样,它都显示两个小数。如果我尝试实现这样一个虚拟属性,那么格式化仍然有效: [DisplayFormat(DataFormatString = "{0:N1}", Ap

我有一个ASP.NET MVC应用程序,其模型具有以下属性:

[DisplayFormat(DataFormatString = "{0:N1}", ApplyFormatInEditMode = true)]
public List<decimal?> Scores { get; set; }
事实并非如此。不管怎样,它都显示两个小数。如果我尝试实现这样一个虚拟属性,那么格式化仍然有效:

[DisplayFormat(DataFormatString = "{0:N1}", ApplyFormatInEditMode = true)]
public decimal? Test { get; set; } 
// Test is later initalized with 1.35443M and rendered as "1.4"
所以。。。
DisplayFormat
属性是否与不支持列表的编辑器结合使用?有办法解决吗


编辑:我的意思是EditorFor,但写了DisplayFor

这可能会帮助你为我的准代码错误感到抱歉,我的意思是并测试了“EditorFor”@Nilzor你有没有找到解决方法?我遇到了同样的问题,我真的不记得了,我也没有源代码了:(
[DisplayFormat(DataFormatString = "{0:N1}", ApplyFormatInEditMode = true)]
public decimal? Test { get; set; } 
// Test is later initalized with 1.35443M and rendered as "1.4"