add row from asp.net code behind to htmltable
<p>I am trying to add a new row to HtmlTable on click of button Add Row.
It adds one row. But it doesn't add further rows. Please advise.</p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="eLaundrySearchWeb.Test" %&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&gt;
&lt;table id="myTable" runat="server"&gt;
                            &lt;tr&gt;
                                &lt;td&gt;
                                    &lt;asp:DropDownList ID="DropDownList1"   runat="server"&gt;
                                    &lt;/asp:DropDownList&gt;
                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;asp:TextBox ID="txtQty" runat="server"&gt;
                                    &lt;/asp:TextBox&gt;
                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;asp:Button ID="Button1" runat="server" Text="Add Row" OnClick="AddRow_Click" 
                                    /&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                        &lt;/table&gt;
&lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>
</p>

<pre><code>protected void AddRow_Click(object sender, EventArgs e)
    {
        //Random r=new Random();
        //int rv=r.Next(0,100);
        int numOfRows = myTable.Rows.Count;
        HtmlTableRow row = new HtmlTableRow();
        row.ID = "tbl_row"+(numOfRows+1);
        HtmlTableCell cell1 = new HtmlTableCell();
        cell1.ID = "tbl_cell1"+ (numOfRows+1);
        TableCell cell2 = new TableCell();
        cell2.ID = "tbl_cell2" + (numOfRows + 1);
        TextBox tb = new TextBox();
        tb.ID = "tbQty" + (numOfRows + 1);
        cell1.Controls.Add(tb);
        row.Cells.Add(cell1);
        myTable.Rows.Add(row);
        myTable.DataBind();
    }
</code></pre>
