ASP.NET MVC 2和ComponentModel.DataAnnotations验证:最小值属性

Max*_*sky 5 c# asp.net-mvc asp.net-mvc-2-validation data-annotations asp.net-mvc-2

我在ASP.NET MVC 2站点中使用System.ComponentModel.DataAnnotations验证属性修饰了ViewModel .对于我的一个名为Price的字段,我想验证该值是否低于某种程度,在本例中为0.

我知道,RangeAttribute存在具有较低和上部程度的验证,但确实像一个MinimumValueAttribute存在的验证,只有较低的程度

如果没有,我想我会自己动手.

Fel*_*lix 10

在你自己滚动之前 - 试试 [Range(0.05, Double.MaxValue)]