Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataAnnotation for checking if the integer is not a negative value

I have a Quantity column in my table in SQL Server 2008. But I want to write a data annotation in my asp.net mvc web application that checks if the entered value is greater than or equal to 1? So can anyone tell me which data annotation to use?

Thanks

like image 909
John John Avatar asked Feb 14 '23 12:02

John John


1 Answers

does this work?

[Range(1, Int32.MaxValue, ErrorMessage = "Value should be greater than or equal to 1")]
like image 64
avs099 Avatar answered May 15 '23 05:05

avs099