Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Validate integer in viewmodel

$
0
0

I have a form that has an int input but I can't seem to validate it from the browser like I can with strings.

My stringinput I just use this:

[StringLength(90, ErrorMessage = "{0} must be at least {2} and at max {1} characters long.", MinimumLength = 2)]
public string Search { get; set; }

I can also just use MaxLenght on strings. But how can I validate for length of integers?

Thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles