예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public IEnumerable <ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
        {
            var rule = new CustomModelClientValidationRule(FormatErrorMessage(metadata.GetDisplayName()), "requiredextend");

            yield return(rule);
        }