protected void customUsernameValidator_ServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = false; if (!string.IsNullOrEmpty(txtUsername.Text)) { if (_accountPresenter.DoesUsernameExist(txtUsername.Text)) { args.IsValid = true; this.txtChangePasswordCode.Focus(); } } }
protected void customValidatorUsername_ServerValidate(object source, ServerValidateEventArgs args) { string username = txtUsername.Text; args.IsValid = true; if (!string.IsNullOrEmpty(username)) { if (_accountPresenter.DoesUsernameExist(username)) { args.IsValid = false; } } else { args.IsValid = false; } }