title: ASP.NET NullReferenceException
body: <p>I am trying to write the user login details to the Database.
  When I click the submit button Im getting a NullReferenceException.
  There are 4 TextBoxes
  Username, Email, Password and ConfirmPassword.</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
          {
              if ((RegisterUserWizardStep.FindControl("Password") as TextBox).Text == (RegisterUserWizardStep.FindControl("ConfirmPassword") as TextBox).Text)
             {
                  //call the method to execute insert to the database
                  ExecuteInsert((RegisterUserWizardStep.FindControl("UserName") as TextBox).Text,
                                (RegisterUserWizardStep.FindControl("Email") as TextBox).Text,
                               (RegisterUserWizardStep.FindControl("Password") as TextBox).Text);
                  Response.Write("Record was successfully added!");
                  ClearControls(Page);
            }
              else
              {
                  Response.Write("Password did not match");
                  (RegisterUserWizardStep.FindControl("Password") as TextBox).Focus();
             }
          }
  </code></pre>
  
  <p>Thank you.</p>