private bool UserExists(string usernameEmail) { if (Membership.FindUsersByEmail(usernameEmail) != null) { return true; } return false; } protected void RegisterUser_NextButtonClick(object sender, WizardNavigationEventArgs e) { if (e.CurrentStepIndex == 0) { if (RegisterUser.Email.Trim() == "" || UserExists(RegisterUser.Email)) { lblmsg.Text = "This Email Is already Exist ! Please try Another Email"; lblmsg.ForeColor = Color.Green; e.Cancel = true; } else { e.Cancel = false; } } }
here lblmsg is label for displaying the error message and RegisterUser is ID of CreateUserWizard.