解决方法
您可以根据验证逻辑在
OnServerValidate方法中设置错误消息:
protected void customValidator1_Validate(object sender,ServerValidateEventArgs e) { if (e.Value.Length < 5) { e.IsValid = true; } else { customValidator1.ErrorMessage = "Length must be less than 5."; e.IsValid = false; } }