title: PlaceHolder duplicating on button click-Insert Error too many arguments
body: <p>I'm having the user selecting the amount of textboxes as the need arises; however if the user selects 3 then on button click the count shows 6; hence inserting the data to the database table; it is saying that it has too many arguments. How can I stop it from duplicating and just pass the amount from the populate function.    </p>
  
  <pre><code>using (SqlCommand comm = new SqlCommand("sp_CreateNumber", connection, transaction))
                      {
                          int cont = ContentPlaceHolder1.Controls.Count;
  
                          for (int i = 0; i &lt; cont; i++)
                          {
                              TextBox tx = (TextBox)ContentPlaceHolder1.FindControl("tx" + i);
                              value = tx.Text;
  
                              int parsedValue;
                              if (!int.TryParse(value, out parsedValue))
                              {
                                  lblError.Text = "Please enter only numeric values ";
                                  return;
                              }
                              else
                              {
                                  comm.CommandType = CommandType.StoredProcedure;
  
                                     comm.Parameters["@loadSheetNum"].Value = lblSheet.Text; 
                                  comm.Parameters.Add("@Number", SqlDbType.NVarChar).Value = value;
                                  comm.ExecuteNonQuery();
                              }
  
  
  protected void Page_Load(object sender, EventArgs e)
  {if(!IsPostBack){    
      populate();
      }
      }
  
   public void populate()
  {
  
      int count = Convert.ToInt32(ddlCount.SelectedItem.Value);
      for (int i = 0; i &lt; count; i++)
      {
          TextBox tb = new TextBox();
          tb.ID = "tx" + i;
  
  
          ContentPlaceHolder1.Controls.Add(tb);
          tb.MaxLength = 10;
          ContentPlaceHolder1.Controls.Add(new LiteralControl("&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"));
      }
  }
  </code></pre>