Creating an asp.net server control with jquery
<p>I have done my research before posting this question and I can not find anything helpful. I do not know if it is possible to create asp.net server control with the help of jquery. I have an upload control input that runs at server and I have used a javascript code to create a new upload control input any time a particular button is clicked. But I require a new <strong>RegularExpressionValidator</strong> to be created to control each new upload control. Can this be achieved rather than using multple upload control and <strong>RegularExpressionValidator</strong> on my page. Scrutinize my code on what I have done so far.</p>

<pre><code>function addFileUploadBox() {
if (!document.getElementById || !document.createElement)
    return false;

var uploadArea = document.getElementById("upload-area");
var count = uploadArea.getElementsByTagName("input").length;

    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 = "20";

    // 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);
    newUploadBox.setAttribute("runat", "server");
    uploadArea.appendChild(newUploadBox);
    $("&lt;asp:RegularExpressionValidator ID='regular" + addFileUploadBox.lastAssignedId + "' ValidationExpression='(.*?)\.(jpg|jpeg|png|gif|JPG)$' runat='server' ErrorMessage='Invalid file' ControlToValidate='dynamic" + addFileUploadBox.lastAssignedId + "' ForeColor='Red'&gt;&lt;/asp:RegularExpressionValidator&gt;").insertAfter("#dynamic" + addFileUploadBox.lastAssignedId);
    addFileUploadBox.lastAssignedId++;
}
</code></pre>
