Click here to Skip to main content
16,017,922 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Data annotations are useful for window forms as well as MVC pages. I like the fact that I can specify them statically with the classes I am displaying for input or editing.

I cannot seem to constrain a string length to between two numbers (say >= length 10, <= length 60).
I can specify that it is required, but not that it is of a specific length.

Here is a code snippet that does not work:

<stringlength(10,> _
<required(errormessage:> _
Property Title As String

Required still works, but stringlength is ignored!
Leon
Posted
Comments
[no name] 12-Jul-15 17:56pm    
http://www.asp.net/mvc/overview/older-versions-1/models-(data)/validation-with-the-data-annotation-validators-vb

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900