Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Message to user when email not unique?

Message to user when email not unique?

Scheduled Pinned Locked Moved ASP.NET
questioncsharpdatabasehelp
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kbalias
    wrote on last edited by
    #1

    Hi I am using Visual Web Developer 2010 Express (with C# as code-behind) to develop a website. I have created a custom MembershipProvider and I have specified that in the web.config that requiresUniqueEmail="true". In the CreateUser() method I check whether the email that the new user has entered is unique and the code works. How do I then display a message to the user in the CreateUserWizard if the email he has entered is not unique? I thought I could reference the CreateUserWizard in the CreateUser() method, but the following does not work:

    Label labelDuplicateEmail = (Label)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LabelDuplicateEmail");
    labelDuplicateEmail.Text = "Email already exists in the database.";

    All help will be appreciated. Kobus

    K 1 Reply Last reply
    0
    • K kbalias

      Hi I am using Visual Web Developer 2010 Express (with C# as code-behind) to develop a website. I have created a custom MembershipProvider and I have specified that in the web.config that requiresUniqueEmail="true". In the CreateUser() method I check whether the email that the new user has entered is unique and the code works. How do I then display a message to the user in the CreateUserWizard if the email he has entered is not unique? I thought I could reference the CreateUserWizard in the CreateUser() method, but the following does not work:

      Label labelDuplicateEmail = (Label)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LabelDuplicateEmail");
      labelDuplicateEmail.Text = "Email already exists in the database.";

      All help will be appreciated. Kobus

      K Offline
      K Offline
      kbalias
      wrote on last edited by
      #2

      Hi I have managed to figure it out. I am using the CreateUserError event of the CreateUserWizard.

      protected void RegisterUser_CreateUserError(object sender, CreateUserErrorEventArgs e)
      {
      Label labelDuplicateEmail = (Label)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("LabelDuplicateEmail");
      labelDuplicateEmail.Text = string.Empty;

      if (e.CreateUserError == System.Web.Security.MembershipCreateStatus.DuplicateEmail)
      {
          labelDuplicateEmail.Text = "Email address already exists in the database.";
      }
      

      }

      Kobus

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups