title: How to add new ASP.NET table row by clicking button?
body: <p>I am using asp.net [ c# ] .. </p>
  
  <p>My question is about adding new row; if I click on that button (like every time I click on that button it will add new row) .. 
  I thought its easy to do it .. but it is not there. Something is missing I don't know what.</p>
  
  <p>My code is [ Default3.aspx ] :</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true"
      CodeFile="Default3.aspx.cs" Inherits="Default3" %&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 align="center"&gt;     
  
  &lt;asp:Table ID="Table1" runat="server"&gt;
      &lt;asp:TableRow&gt;
          &lt;asp:TableCell style="border-style:solid" &gt;
             &lt;asp:Label ID="Label1" runat="server" Text="LABEL = 1 "&gt;
             &lt;/asp:Label&gt;
          &lt;/asp:TableCell&gt;
          &lt;asp:TableCell style="border-style:solid" &gt;
             &lt;asp:Label ID="Label2" runat="server" Text="LABEL = 2 "&gt;
             &lt;/asp:Label&gt;
          &lt;/asp:TableCell&gt;
      &lt;/asp:TableRow&gt;
      &lt;asp:TableRow&gt;
          &lt;asp:TableCell style="border-style:solid" &gt;
             &lt;asp:Label ID="Label3" runat="server" Text="LABEL = 3 "&gt;
             &lt;/asp:Label&gt;
          &lt;/asp:TableCell&gt;
          &lt;asp:TableCell style="border-style:solid" &gt;
             &lt;asp:Label ID="Label4" runat="server" Text="LABEL = 4 "&gt;
             &lt;/asp:Label&gt;
          &lt;/asp:TableCell&gt;
      &lt;/asp:TableRow&gt;
  &lt;/asp:Table&gt;
  
  &lt;asp:Button ID="Button1" runat="server" Text="Add More" 
          onclick="Button1_Click" /&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and for my C# [ Default3.aspx.cs ] :</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
  
      TableRow NewRow1 = new TableRow();
  
      //1st cell
      TableCell NewCell1 = new TableCell();
      NewCell1.Style.Add("border-style","solid");
  
      // new lebel
      Label newLable1 = new Label();
      count = count + 1; // just for change number in label text 
      newLable1.Text = "NewLabel = "+ count;
  
      // adding lebel into cell
      NewCell1.Controls.Add(newLable1);
  
      // adding cells to row
      NewRow1.Cells.Add(NewCell1);
  
      //2ed cell
      TableCell NewCell2 = new TableCell();
      NewCell2.Style.Add("border-style", "solid");
  
      Label newLable2 = new Label();
      count = count + 1;
      newLable2.Text = "NewLabel = " + count;
      NewCell2.Controls.Add(newLable2);
      NewRow1.Cells.Add(NewCell2);
  
      //adding row into table
      Table1.Rows.Add(NewRow1);
  
  
  }
  </code></pre>
  
  <p>I don't know what the problem is .. I even give each controls an IDs .. and I tried other ways but didn't work .. </p>
  
  <p>Please if anyone can help me out .. I feel like am missing something important but I don't know what it is ..</p>