Int or Number DataType for DataAnnotation validation attribute

前端 未结 8 2434
我寻月下人不归
我寻月下人不归 2020-12-07 10:41

On my MVC3 project, I store score prediction for football/soccer/hockey/... sport game. So one of properties of my prediction class looks like this:

[Range(0         


        
8条回答
  •  北海茫月
    2020-12-07 11:06

    Use regex in data annotation

    [RegularExpression("([0-9]+)", ErrorMessage = "Please enter valid Number")]
    public int MaxJsonLength { get; set; }
    

提交回复
热议问题