I am trying to use asp.net mvc 3 unprostructed javascript with jquery.
I follow this tutorial
It is not clear how to take the first step.
I thought this just overrides IsValid, but I keep getting the error, so I have to do something wrong
public class EmailAttribute : ValidationAttribute, IClientValidatable { public override bool IsValid(object value) { return base.IsValid(value); } public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { yield return new ModelClientValidationEmailRule(FormatErrorMessage(metadata.GetDisplayName())); } } public class ModelClientValidationEmailRule : ModelClientValidationRule { public ModelClientValidationEmailRule(string errorMessage) { base.ErrorMessage = errorMessage; base.ValidationType = "email"; } }
I get this error
IsValid(object value) has not been implemented by this class. The preferred entry point is GetValidationResult() and classes should override IsValid(object value, ValidationContext context). Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NotImplementedException: IsValid(object value) has not been implemented by this class. The preferred entry point is GetValidationResult() and classes should override IsValid(object value, ValidationContext context). Source Error: Line 13: public override bool IsValid(object value) Line 14: { Line 15: return base.IsValid(value); Line 16: } Line 17:
c # asp.net-mvc asp.net-mvc-3 data-annotations
chobo2
source share