First time using the ASP.NET CreateUserWizard control and we are aliasing the Username Textbox as the Email Address because the clients wants the username to be an email address. Then hiding that controls EmailAddress. This part is working fine. The problem I'm having is the error message that gets displayed on the UI says "Please enter a different user name." if you type in a existing email address. We need to change this to "Please enter a different email address". I added a event handler for the OnCreateUserError. Added the code below, and debugging the events gets hit and sets the Literal.Text of the error message to display. Still gets overwritten on a later event. Does anyone know what I'm missing to get this error message to the UI.
protected void userWizard_CreateUserError(object sender, CreateUserErrorEventArgs e)
{
// check for dupe username error
if (e.CreateUserError == MembershipCreateStatus.DuplicateUserName)
{
// If so change to dupe email error and set the literal
e.CreateUserError = MembershipCreateStatus.DuplicateEmail;
Literal errorMessage = (Literal)userWizard.WizardSteps[0].Controls[0].Controls[0].Controls[0].Controls[0].FindControl("ErrorMessage");
errorMessage.Text = "Email address already exists. Please enter a different email address.";
}
}