title: get values from dynamically added textboxes asp.net c#
body: <p>as suggested in the title i have in which i can insert how many textboxes i want to add to a placeholder. i can add the textboxes just fine the problem is i cant get the values inserted on those dynamically added textboxes. here's my code</p>
  
  <p>the purpose of this piece of code is to whenever the textbox in which i can introduce the number of textboxes i want. it creates and adds them to the placeholder in my page.</p>
  
  <pre><code>public void txtExtra_TextChanged(object sender, EventArgs e)
  {  
      for (a = 1; a &lt;= int.Parse(txtExtra.Text); a++)
      {
           TextBox txt = new TextBox();
           txt.ID = "txtquestion" + a;
           pholder.Controls.Add(txt);
      }
  }
  </code></pre>
  
  <p>this is the code of the button that will submit and response.write the values inserted in all those textboxes.</p>
  
  <pre><code>protected void btnConfirm_Click(object sender, EventArgs e)
  {
       foreach (Control ctr in pholder.Controls)
       {
           if (ctr is TextBox)
           {        
                string value = ((TextBox)ctr).Text;
                Response.Write(value);  
           } 
       }
   }
  </code></pre>
  
  <p>i've been searching online and i've been getting answers that this code is fine and it should work but it doesnt. if you guys see anything wrong or have any suggestion that can solve my problem i'd really appreciate it</p>