title: JavaScript in asp:Wizard
body: <p>I am having a wizardcontrol, where in one step the user can input his name, emailaddress, phonenumber etc.</p>
  
  <p>When the user press the "Next" button of the wizard, I'm checking the database to see if there is an excisting account with the specified phonenumber.</p>
  
  <p>If that is the case, the system is supposed to ask the user if he will bind the new information to that number, or if he will enter a new phonenumber.</p>
  
  <p>If he says that he will bind the information, the information is binded and wizard proceeds to step2, and if he will enter a new phonenumber the wizard stays at step1.</p>
  
  <p>The code looks something like this:</p>
  
  <pre><code>protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
  {
      if (Wizard1.ActiveStepIndex == 0)
      {
          Page.Validate();
          if (Page.IsValid)
          {
              if (!Mobile_ValidateForExistingUsers(((TextBox)WizardStep1.ContentTemplateContainer.FindControl("txtPhone")).Text))
              {
          //JavaScript popup or something, which prompts the user?
              }
          }
      }
  }
  </code></pre>
  
  <p>where the validater is:</p>
  
  <pre><code>protected bool Mobile_ValidateForExistingUsers(string usrPhone)
  {
      bool IsValid = false;
  
      using (SqlConnection conn = new SqlConnection(connString))
      using (SqlCommand cmd = new SqlCommand("spCheckMobile", conn))
      {
          cmd.CommandType = System.Data.CommandType.StoredProcedure;
          cmd.Parameters.Add(new SqlParameter("@Mobile", usrPhone));
  
          cmd.Connection.Open();
  
          object result = cmd.ExecuteScalar();
  
          if (result == null)
          {
              IsValid = true;
          }
      }
      return IsValid;
  }
  </code></pre>
  
  <p>How to ask the user this question, and either proceed or let him enter some new information in a wizard?</p>