title: How to dynamic adding rows into asp.net table?
body: <p>How can I add rows in a table from server-side?</p>
  
  <pre><code>  if (!Page.IsPostBack)
    {
        Session["table"] = TableId;
    }
    else
    {
        TableId = (Table)Session["table"];
    }
  
  protected void btnAddinRow_Click(object sender, EventArgs e)
  {
        num_row = (TableId.Rows).Count;
  
        TableRow r = new TableRow();
        TableCell c1 = new TableCell();
        TableCell c2 = new TableCell();
        TextBox t = new TextBox();
  
        t.ID = "textID" + num_row;
        t.EnableViewState = true;
  
        r.ID = "newRow" + num_row;
        c1.ID = "newC1" + num_row;
        c2.ID = "newC2" + num_row;
  
        c1.Text = "New Cell - " + num_row;
        c2.Controls.Add(t);
  
        r.Cells.Add(c1);
        r.Cells.Add(c2);
  
        TableId.Rows.Add(r);
        Session["table"] = TableId;
  }
  </code></pre>
  
  <p>in debug I found out the number in the "TableID", but the rows are not drawn.</p>
  
  <p>Have you got an idea about this issue?
  Thanks</p>