title: How to Update the value of textbox in asp.net using c#?
body: <p>I have this program in asp.net using C#
  .aspx</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div id="first" runat="server"&gt;
          Text Boxes
          &lt;asp:TextBox ID="txtnr" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;
          &lt;asp:Button ID="btnxt1" runat="server" Text="Next" onclick="btnxt1_Click"/&gt;&lt;br /&gt;
      &lt;/div&gt;
      &lt;div id="second" runat="server"&gt;
          &lt;asp:Table ID="tbl" runat="server"&gt;&lt;/asp:Table&gt;
          &lt;asp:Button ID="btnx2" runat="server" Text="Next" onclick="btnx2_Click"/&gt;&lt;br /&gt;
      &lt;/div&gt;
  
      &lt;div id="third" runat="server"&gt;
          &lt;asp:Label ID="lblxx" runat="server" Text=""&gt;&lt;/asp:Label&gt;&lt;br /&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  public partial class _Default : System.Web.UI.Page
  {
  
      static int numr = 0;
      static TableHeaderCell[] tc2;
      static TextBox[] txtb;
      protected void Page_Load(object sender, EventArgs e){}
  
      protected void btnxt1_Click(object sender, EventArgs e)
      {
          numr = int.Parse(txtnr.Text);
          TableHeaderRow tr;
          tc2 = new TableHeaderCell[numr];
          txtb = new TextBox[numr];
          for (int i = 0; i &lt; numr; i++)
          {
              tr = new TableHeaderRow();
              tc2[i] = new TableHeaderCell();
              txtb[i] = new TextBox();
              txtb[i].Text = "w";
              tc2[i].Controls.Add(txtb[i]);
              tr.Controls.Add(tc2[i]);
              tbl.Controls.Add(tr);
          }
      }
  
      protected void btnx2_Click(object sender, EventArgs e)
      {
          for (int i = 0; i &lt; numr; i++)
              lblxx.Text += txtb[i].Text+"&lt;br/&gt;";
      }
  }
  </code></pre>
  
  <p>Program steps:</p>
  
  <ul>
  <li>enter number of text-boxes to appear (say = 4) and click 'Next' <br/></li>
  <li>four text-boxes will appear (the program sets the value of textbox = "w",to understand the problem)<br/></li>
  <li>user can set other value for the text for the four text boxes (say: 1 , 2 , 3 , 4) then click next<br/></li>
  <li>finally, the program print the values of text boxes, but the problem is the program 
  will print: wwww not "1234" :( ??</li>
  </ul>
  
  <p>How to fix this problem?? </p>