开发者

How would I validate string length using DataAnnotations in asp.net mvc?

开发者 https://www.devze.com 2022-12-16 01:11 出处:网络
I am using DataAnnotations in an ASP.NET MVC 1 application to check for Required fields and numerical ranges using the Required and Range attributes.

I am using DataAnnotations in an ASP.NET MVC 1 application to check for Required fields and numerical ranges using the Required and Range attributes.

I am looking for the best way to validate the length of strings in a few input text boxes. I see that there is a RegularExpression attribute that could do the job but I was wondering if there was a more specific attribute to do this?

Also if anyone can point me to a decent resource regarding using DataAnnotations I would be 开发者_开发知识库very grateful.


How about the StringLength attribute?

0

精彩评论

暂无评论...
验证码 换一张
取 消