how to delete textboxes dynamically
<p>cs code</p>

<pre><code> protected void DeleteNewRowToGrid()
    {
        int rowIndex = 0; 
        if (ViewState["dtCurrentTable"] != null)
        {
            DataTable DeldtCurrentTable = (DataTable)ViewState["dtCurrentTable"];
            DataRow drCurrentRow = null;
            if (DeldtCurrentTable.Rows.Count &gt; 0)
            {
                for (int i = 1; i &gt; DeldtCurrentTable.Rows.Count; i--)
                {
                    //extract the TextBox values
                    TextBox box1 = (TextBox)Gridview1.Rows[rowIndex].Cells[1].FindControl("TextBox1");
                    //TextBox box2 = (TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("TextBox2");
                    DropDownList box2 = (DropDownList)Gridview1.Rows[rowIndex].Cells[2].FindControl("ddldatatype");

                    drCurrentRow = DeldtCurrentTable.NewRow();
                    drCurrentRow["RowNumber"] = i - 1;
                    drCurrentRow["Column1"] = box1.Text;
                    drCurrentRow["Column2"] = box2.Text;
                    //drCurrentRow["Column3"] = box3.Text;

                    rowIndex--;
                }
                //add new row to DataTable
                DeldtCurrentTable.Rows.Remove(drCurrentRow);
                //Store the current data to ViewState
                ViewState["dtCurrentTable"] = DeldtCurrentTable;

                //Rebind the Grid with the current data
                Gridview1.DataSource = DeldtCurrentTable;
                Gridview1.DataBind();
            }
        }
    }

    protected void ButtonDel_Click(object sender, EventArgs e)
    {
        DeleteNewRowToGrid();
    }
aspx code

 &lt;asp:gridview ID="Gridview1" runat="server" ShowFooter="true" AutoGenerateColumns="false"&gt;
        &lt;Columns&gt;
        &lt;asp:BoundField DataField="RowNumber" HeaderText="Row Number" /&gt;
        &lt;asp:TemplateField HeaderText="Column Name"&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
     &lt;%-- &lt;asp:TemplateField HeaderText="Header 2"&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:TextBox ID="TextBox2" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;--%&gt;
        &lt;asp:TemplateField HeaderText="Data Type"&gt;
            &lt;ItemTemplate&gt;
                  &lt;asp:DropDownList ID="ddldatatype" runat="server"&gt;
                  &lt;asp:ListItem&gt;varchar&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem&gt;int&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem&gt;numeric&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem&gt;uniqueidentifier&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem&gt;char&lt;/asp:ListItem&gt;
                  &lt;/asp:DropDownList&gt;
            &lt;/ItemTemplate&gt;
            &lt;FooterStyle HorizontalAlign="Right" /&gt;
            &lt;FooterTemplate&gt;
            &lt;asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" OnClick="ButtonAdd_Click"/&gt;
             &lt;asp:Button ID="ButtonDel" runat="server" Text="Delete Row" OnClick="ButtonDel_Click"/&gt;
             &lt;input type="hidden" runat="server" value="0" id="hiddencount" /&gt;
            &lt;/FooterTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;/Columns&gt;
&lt;/asp:gridview&gt;

I have done with add rwo, now I want to delete
</code></pre>
