Following is how range validator is configured in one of my MVC model.

[Display(Name = "Event ID")]
[Range(0, 2147483647)]
[Required(ErrorMessage="Event ID must be entered")]
public int? ID_EVENTO { get; set; }

While trying to input "32167", it gives me an error message saying "Event ID can be maximum of 2147483647. It is accepting only few 4 digit values.

Any idea of what could be the issue?

有帮助吗?

解决方案

Maybe, in your Model, ID_EVENTO is System.Int16 in place of System.Int32 (that is, if you are using SQL Server, the field is smallint in place of int).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top