Remove added control with Javascript in ASP.NET
<p>I'm trying to removed the added controls. Here's the mark-up that adds upload controls to the page:</p>

<pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %&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&gt;
    &lt;title&gt;Multi File Upload&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server" enctype="multipart/form-data"&gt;
&lt;p id="upload-area"&gt;
   &lt;input id="File1" type="file" runat="server" size="60" /&gt;
&lt;/p&gt;

&lt;input id="AddFile" type="button" value="Add file" onclick="addFileUploadBox()" /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
&lt;p&gt;&lt;asp:Button ID="btnSubmit" runat="server" Text="Upload Now" OnClick="btnSubmit_Click" /&gt;&lt;/p&gt;
&lt;span id="Span1" runat="server" /&gt;
&lt;script type="text/javascript"&gt;
function addFileUploadBox()
{
    if (!document.getElementById || !document.createElement)
        return false;

    var uploadArea = document.getElementById ("upload-area");

    if (!uploadArea)
        return;

    var newLine = document.createElement ("br");
    uploadArea.appendChild (newLine);

    var newUploadBox = document.createElement ("input");

    // Set up the new input for file uploads
    newUploadBox.type = "file";
    newUploadBox.size = "60";

    // The new box needs a name and an ID
    if (!addFileUploadBox.lastAssignedId)
        addFileUploadBox.lastAssignedId = 100;

    newUploadBox.setAttribute ("id", "dynamic" + addFileUploadBox.lastAssignedId);
    newUploadBox.setAttribute ("name", "dynamic:" + addFileUploadBox.lastAssignedId);
    uploadArea.appendChild (newUploadBox);
    addFileUploadBox.lastAssignedId++;
}
&lt;/script&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Thank.</p>
