how to delete dynamic control(textbox and button) when user click delete button
<p>this is my code and i want to know how i add some code to delete dynamic control(textbox and button) when user click delete button. Please help me T_T</p>

<p>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;</p>

<p>public partial class _Default : System.Web.UI.Page
{</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{
    if (IsPostBack)
    {
        CreateTextBox();
    }
    else
    {
        Session["arrayTextBox"] = null;
        Session["arrayButton"] = null;
    }
}

protected void CreateTextBox()
{
    List&lt;TextBox&gt; arrayTextBox = new List&lt;TextBox&gt;();

    List&lt;Button&gt; arrayButton = new List&lt;Button&gt;();

    if (TextBox1.Text != "")
    {            
        if (Session["arrayTextBox"] != null)
        {
            arrayTextBox = (List&lt;TextBox&gt;)Session["arrayTextBox"];
            arrayButton = (List&lt;Button&gt;)Session["arrayButton"];
        }

        TextBox aTextBox = new TextBox();

        aTextBox.ID = "aTextBox" + arrayTextBox.Count.ToString();
        aTextBox.Text = TextBox1.Text;

        Button ButtonDelete = new Button();
        ButtonDelete.ID = "ButtonDelete" + arrayButton.Count.ToString();
        ButtonDelete.Text = "Delete";

        //if (TextBox2.Text != "")
        //{
        //    String red = TextBox2.Text.ToString().Substring(0, 2);
        //    String green = TextBox2.Text.ToString().Substring(2, 2);
        //    String blue = TextBox2.Text.ToString().Substring(4, 2);

        //    int r = int.Parse(red, NumberStyles.AllowHexSpecifier);
        //    int g = int.Parse(green, NumberStyles.AllowHexSpecifier);
        //    int b = int.Parse(blue, NumberStyles.AllowHexSpecifier);

        //    aTextBox.BackColor = System.Drawing.Color.FromArgb(r, g, b);
        //}

        arrayTextBox.Add(aTextBox);
        arrayButton.Add(ButtonDelete);

        for(int i=0;i&lt;arrayTextBox.Count;i++)
        {              
            PlaceHolder1.Controls.Add(arrayTextBox[i]);
            PlaceHolder1.Controls.Add(arrayButton[i]);
            PlaceHolder1.Controls.Add(new LiteralControl(@"&lt;br /&gt;"));
        }

        //ButtonDelete.Click += new EventHandler(ButtonDelete_Click);


        Session["arrayTextBox"] = arrayTextBox;
        Session["arrayButton"] = arrayButton;

        TextBox1.Text = "";
        //TextBox2.Text = "";
    }


}
</code></pre>

<p>}</p>
