3

我的领域有以下属性:

[Range(-1,200)]
public decimal MyValue{ get; set; }

如果我输入任何不在我得到的范围内的值:

The field must be between -1 and 200

这可以。

这是问题所在,当我输入有效值为零时,我收到“该字段必须是数字”验证消息。

有什么建议么?
谢谢

4

1 回答 1

0

我认为这可能是由于decimal类型而发生的。尝试这个:

[Range(typeof(Decimal),"-1", "200")]
public decimal MyValue{ get; set; }

资源。

于 2013-08-02T17:25:51.080 回答