CODEDIGEST
Home » CodeDigest
Search
 

Technologies
 

Clearing ASP.Net FileUpload Control in Javascript
Submitted By Satheesh Babu B
On 11/27/2008 5:32:16 AM
Tags: asp.net,CodeDigest,Javascript  

Clearing ASP.Net FileUpload Control in Javascript

 

The following script will help us to clear the FileUpload control in ASP.Net 2.0.

 

<script language="javascript">

    function ClearFileUpload()

    {

    var fil = document.getElementById("FileUpload1");

   fil.select();

   n=fil.createTextRange();

   n.execCommand('delete');

   fil.focus();

    }

    </script>

 

<asp:FileUpload ID="FileUpload1" runat="server" />

<asp:Button ID="Button1" runat="server" OnClientClick="ClearFileUpload()" Text="Clear" />

 

When we click the Clear button the FileUpload control will be cleared.

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..