public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { KeyValuePair <string, object>[] args = new KeyValuePair <string, object>[] { new KeyValuePair <string, object>("pattern", this.Pattern) }; var rule = new CustomModelClientValidationRule(FormatErrorMessage(metadata.GetDisplayName()), "regexcustomchars", args); yield return(rule); }
public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { KeyValuePair <string, object>[] args = new KeyValuePair <string, object>[] { new KeyValuePair <string, object>("maxlength", this.MaximumLength) }; var rule = new CustomModelClientValidationRule(FormatErrorMessage(metadata.GetDisplayName()), "stringlengthextend", args); yield return(rule); }
public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { var rule = new CustomModelClientValidationRule(FormatErrorMessage(metadata.GetDisplayName()), "requiredextend"); yield return(rule); }