Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi Everybody,

I have a model Property (FirstName) in which have i am applying an attribute
StringLength(2,30,ErrorMessage="Please provide a valid name.")

this is working fine. but my requirement is when i am placing only single char then the error is firing. so i need to validate the control on onblur not in change. so can anyone suggest me how to do that.

and i want these implementation on some properties not in all.



thanks
Posted

1 solution

You can easily achieve that by removing data annotation for those properties and use jQuery or jQuery Validation Plugin.Then you will have full control for your validations.

Here is the jQuery Validation Plugin :

http://jqueryvalidation.org/documentation/[^]


I hope this will help to you.
 
Share this answer
 

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