Range attribute for the decimal value

时间:2017-10-12 09:54:45

标签: c# asp.net asp.net-core asp.net-core-2.0

I have the following

/// <summary>The project budget</summary>                
[Range(0, double.MaxValue, ErrorMessage = "Must be a positive number")]
public double? Budget { get; set; }

But the values like "7.5" or "7,5" (culture format variant) does not pass the validation. Why?

enter image description here enter image description here

Could the nullable double? type be the cause?

PS. Just tested, the non-nullable decimal value does not change the behavior, I have the same results..

0 个答案:

没有答案