public void AttachValidators(EmailValidatorAttribute validator, WebControl control)
        {
            control.Attributes.Add("type", "email");

            control.Attributes.Add("minlength", validator.MinSize.ToString(CultureInfo.InvariantCulture));
            control.Attributes.Add("maxlength", validator.MaxSize.ToString(CultureInfo.InvariantCulture));

            if (validator.IsRequired)
            {
                control.Attributes.Add("required", "required");
            }

            control.Attributes.Add("data-error", "test message");
        }
        private void AttachValidators(EmailValidatorAttribute validator, Object control)
        {
            FieldHelper.ApplyWebControlAttribute(control, "type", "email");

            FieldHelper.ApplyWebControlAttribute(control, "minlength", validator.MinSize.ToString(CultureInfo.InvariantCulture));
            FieldHelper.ApplyWebControlAttribute(control, "maxlength", validator.MaxSize.ToString(CultureInfo.InvariantCulture));

            if (validator.IsRequired)
            {
                FieldHelper.ApplyWebControlAttribute(control, "required", "required");
            }

            FieldHelper.ApplyWebControlAttribute(control, "data-error", "test message");
        }
Пример #3
0
 private void AttachValidators(EmailValidatorAttribute validator, object control)
 {
     FieldHelper.SetPropertyValue(control, "MaxLength", validator.MaxSize.ToString(CultureInfo.InvariantCulture));
 }