public IEnumerable <SelectListItem> GetSelectListItems(RequestContext requestContext, string filter = null)
        {
            var validators = ControlValidators.Validators();

            foreach (var item in validators)
            {
                yield return(new SelectListItem()
                {
                    Text = item.Name,
                    Value = item.Name
                });
            }
        }
Beispiel #2
0
        public static IEnumerable <ModelClientValidationRule> GetClientValidationRules(this CustomFieldDefinition field)
        {
            var rules      = Enumerable.Empty <ModelClientValidationRule>();
            var validators = ControlValidators.Validators().ToList();

            foreach (var rule in field.ValidationRules)
            {
                var validator = validators.Find(v => v.Name == rule.ValidatorName);
                if (validator != null)
                {
                    rules = rules.Union(validator.GetClientValidationRules(field, rule));
                }
            }

            return(rules);
        }
Beispiel #3
0
 private void txtUserName_KeyPress(object sender, KeyPressEventArgs e)
 {
     ControlValidators.ValidateLength(txtUserName, e, 100);
 }
 private void txtEmail_KeyPress(object sender, KeyPressEventArgs e)
 {
     ControlValidators.ValidateLength(txtEmail, e, 20);
 }