title: Dynamically created TextBoxes in a Table lost Text value
body: <p>I have a Table dynamically generated and inside of 2 columns there are TextBoxes. During the postback the Textboxes are always empty even if I fill them.
  The table is builted in this way:</p>
  
  <pre><code>  protected void ddlScalaTaglie_SelectedIndexChanged(object sender, EventArgs e)
      {
          DataTable dtRighe = oTab.getScaleTaglieRighe(ddlScalaTaglie.SelectedValue);
  
          //dt is datatable object which holds DB results.
          Table tbl = new Table();
          tbl.CssClass = "table table-striped  table-bordered table-responsive";
  
          TableRow tr;
          TableCell tcEU, tcUS, tcUK, tcQty, tcEAN;
          Label lbEU, lbUS, lbUK, lbQty, lbEAN;
          TextBox tbEU, tbUS, tbUK, tbQty, tbEAN, tbToFocus = null;
  
          foreach (DataRow dr in dtRighe.Rows)
          {
              tr = new TableRow();
  
              //ean
              tcEAN = new TableCell();
              tbEAN = new TextBox();
              tbEAN.ID = "txtEAN" + dr[0].ToString();
              tbEAN.Width = new Unit(100, UnitType.Percentage);
              tbEAN.Columns = 15;
              tcEAN.Controls.Add(tbEAN); 
              tr.Controls.Add(tcEAN);
  
              //Qty
              tcQty = new TableCell();
              tbQty = new TextBox(); 
              tbQty.ID = "txtQty" + dr[0].ToString(); 
              tbQty.TextMode = TextBoxMode.Number; 
              tcQty.Controls.Add(tbQty);
              tr.Controls.Add(tcQty);            
  
              tbl.Controls.Add(tr);
          }
  
          Session["tbl"] = tbl;
  
          divTaglieRighe.Controls.Add(tbl);
      }
  </code></pre>
  
  <p>When I click the button SAVE, I have to loop throug my table and save all the TextBox.Text...</p>
  
  <p>this is what I wrote:</p>
  
  <pre><code> ArrayList arrScarpaFigli = new ArrayList();
   Table tbl = (Table)Session["tbl"];
   foreach (TableRow row in tbl.Rows)
   {
       foreach (TableCell cell in row.Cells)
       {
          foreach (Control ctrl in cell.Controls)
          {
             //CONTROL IS TEXBOXT: EXTRACT VALUES//
              if (ctrl is TextBox)
              {
                  TextBox txt = (TextBox)ctrl;
                  arrScarpaFigli.Add(txt.Text);
               }
           }
        }
    }
  </code></pre>
  
  <p>The problem is that, also if I fill the textboxes, in my Text there is always an empty string.
  The only moment when I fill the table is on the selectionChange of a Dropdown.</p>
  
  <p>What I'm doing wrong?
  Thanks in advance</p>