public virtual void CreateClientValidator(Page page, StringBuilder sb, string clientID, string controlToValidate, ValidatorDisplay display, string validationGroup, object controlValue) { controlValues.Add(controlValue); var isValid = ValidateValue((controlValue ?? "").ToString()); clientValidatorInfos[clientID] = new clientValidatorInfo { clientID = clientID, controlToValidate = controlToValidate, display = display, isValid = isValid, validationGroup = validationGroup, }; sb.Append(" <span id=\""); sb.Append(clientID); sb.Append("\" style=\"color:Red;"); if (isValid) { sb.Append("display:none;"); } sb.Append("\">"); sb.Append(ErrorMessage); sb.Append("</span>"); if (!isAddedToPage) { page.Validators.Add(this); isAddedToPage = true; } }
protected override void RegisterClientValidator(Page page, clientValidatorInfo validatorInfo, int number) { base.RegisterClientValidator(page, validatorInfo, number); AddExpandoAttribute(page, null, validatorInfo.clientID, "evaluationfunction", "RegularExpressionValidatorEvaluateIsValid", false); if (!string.IsNullOrEmpty(RegularExpression)) { AddExpandoAttribute(page, null, validatorInfo.clientID, "validationexpression", RegularExpression); } }
protected virtual void RegisterClientValidator(Page page, clientValidatorInfo validatorInfo, int number) { AddExpandoAttribute(page, null, validatorInfo.clientID, "controltovalidate", validatorInfo.controlToValidate); AddExpandoAttribute(page, null, validatorInfo.clientID, "focusOnError", "t", false); AddExpandoAttribute(page, null, validatorInfo.clientID, "errormessage", ErrorMessageInSummary + number.ToString(" (#0)")); if (validatorInfo.display != ValidatorDisplay.Static) { AddExpandoAttribute(page, null, validatorInfo.clientID, "display", PropertyConverter.EnumToString(typeof(ValidatorDisplay), validatorInfo.display), false); } if (!validatorInfo.isValid) { AddExpandoAttribute(page, null, validatorInfo.clientID, "isvalid", "False", false); } if (validatorInfo.validationGroup.Length > 0) { AddExpandoAttribute(page, null, validatorInfo.clientID, "validationGroup", validatorInfo.validationGroup); } }
protected override void RegisterClientValidator(Page page, clientValidatorInfo validatorInfo, int number) { base.RegisterClientValidator(page, validatorInfo, number); AddExpandoAttribute(page, null, validatorInfo.clientID, "evaluationfunction", "RequiredFieldValidatorEvaluateIsValid", false); AddExpandoAttribute(page, null, validatorInfo.clientID, "initialvalue", null); }