protected void EmailValidator_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator sender = (CustomValidator)source; SS.Model.User u = UserService.GetUser(txtEmail.Text); if (u.EMail != CurrentUser.EMail) { sender.ErrorMessage = "The email entered has been used, please enter a new email address"; args.IsValid = false; } else { args.IsValid = true; } }
protected void EmailValidator_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator sender = (CustomValidator)source; SS.Model.User u = UserService.GetUser(txtEmail.Text); Portfolio portfolio = PortfolioService.GetPortfolioByUser(u); if (u != null && PortfolioId == -1) { sender.ErrorMessage = "The email entered has been used, please enter a new email address"; args.IsValid = false; } else { args.IsValid = true; } }