我是MVC的新手。我试图仅为整数验证文本框值。
这是我迄今为止尝试过的属性和数据注释
[Required(ErrorMessage = @"Must Enter EOT Months")]
[RegularExpression("([0-9]+)", ErrorMessage = @"EOT Months ")]
[Range(0, int.MaxValue, ErrorMessage = @"EOT Months must be numeric and a whole number")]
public int PayoutEOTMths
{
get { return DisposalConstant.PayoutEOTMths; }
set { DisposalConstant.PayoutEOTMths = value; }
}
但每当我输入6.5等值时。它给我提供了
的默认验证消息•The value '6.5' is not valid for PayoutEOTMths.