Custom Data Annotation Validator Part II: Client Code
Posted by: K. Scott Allen,
on 23 Feb 2011 |
View original | Bookmarked: 0 time(s)
The validator we looked at in the last post only supports server side validation. To support client side validation we need a little more code on the server, and some custom client script. One approach to client validation is to have the validation attribute implement the IClientValidatable interface, which requires a single method: GetClientValidationRules. public class DateGreaterThanAttribute :
ValidationAttribute,
IClientValidatable
{
public...