There is a CustomValidator for example:

 protected void CheckAge_ServerValidate(object source, ServerValidateEventArgs args) { if (//условие) { args.IsValid = false; CheckAge_CustomValidator.ErrorMessage = "Error!"; } else args.IsValid = true; } 

You need to call the validator in Page_Load() and you need the result of the validator
If the validator earned, then perform the action
I tried this:

  if (CheckAge_CustomValidator.IsValid == false) //если заработал и показывает ошибку { //------- } 
  • one
    I think we need to call validator.Validate(); - tym32167
  • @ tym32167, where to call? how it will be in condition - Zhandos
  • one
    before checking for IsValid - tym32167

0