title: how to get multiple value from dynamic generated multiple textbox in asp.net c#
body: <p>I want to get value from textbox which is dynamically generated.
  Given below is my code, But Every time a was get null value.</p>
  
  <p>Default.aspx:</p>
  
  <pre><code> &lt;asp:Panel ID="Panel1" runat="server" style="width:460px"&gt;
   &lt;asp:PlaceHolder id="Area1" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
    &lt;/asp:Panel&gt;
  
  
  &lt;asp:Button ID="Button1" runat="server" Text="Button" 
     onclick="Button1_Click1" /&gt;
  &lt;asp:Button ID="Button2" runat="server" Text="save" onclick="Button2_Click" /&gt;
  </code></pre>
  
  <p>Default.aspx.cs</p>
  
  <pre><code> protected void Button1_Click1(object sender, EventArgs e)
   {
      CreateTextBox();
  
   }
   public void CreateTextBox()
   {
  
      int rowCount = 0;
      //initialize a session.
      rowCount = Convert.ToInt32(Session["clicks"]);
  
      rowCount++;
  
      //In each button clic save the numbers into the session.
      Session["clicks"] = rowCount;
  
  
      //Create the textboxes and labels each time the button is clicked.
      for (int i = 0; i &lt; rowCount; i++)
      {
  
          TextBox TxtBoxU = new TextBox();
  
          TextBox TxtBoxE = new TextBox();
  
          Label lblU = new Label();
          Label lblE = new Label();
  
          TxtBoxU.ID = "TextBoxU" + i.ToString();
          TxtBoxE.ID = "TextBoxE" + i.ToString();
  
          lblU.ID = "LabelU" + i.ToString();
          lblE.ID = "LabelE" + i.ToString();
  
  
          lblU.Text = "Header " + (i + 1).ToString() + " : ";
          lblE.Text = "Value " + (i + 1).ToString() + " : ";
  
          //Add the labels and textboxes to the Panel.
          Area1.Controls.Add(lblU);
          Area1.Controls.Add(TxtBoxU);
  
          Area1.Controls.Add(lblE);
          Area1.Controls.Add(TxtBoxE);
      }
  }
  protected void Button2_Click(object sender, EventArgs e)
  {
      int count=Convert.ToInt32( Session["clicks"]);
      for(int j=0;j&lt;count;j++)
      {
  
          TextBox aa = (TextBox)Area1.FindControl("TextBoxU"+j);
          Response.Write(aa.Text);
  
          TextBox bb = (TextBox)Area1.FindControl("TextBoxE" + j);
          Response.Write(bb.Text);
  
      }
   }
  </code></pre>
  
  <p>SO, Please given a proper resolution of this query.
  Thank You.</p>