How to reset RadAsyncUpload after submission in the code behind?

6.7k Views Asked by At

I wonder how to reset (clear) RadAsyncUpload and leave the component as in the initial state

after the submission in the code behind?


my aspx ::

<telerik:RadAsyncUpload runat="server" ID="rada_attach" OnClientFileUploaded="onClientFileUploaded"
MultipleFileSelection="Disabled" InitialFileInputsCount="1" MaxFileInputsCount="1"
Width="100%" />
2

There are 2 best solutions below

1
Yuriy Rozhovetskiy On BEST ANSWER

Try to add code below to Click event handler of submit button (not tested)

ScriptManager.RegisterStartupScript(this, this.GetType(), "clearUpload", String.Format("$find('{0}').deleteAllFileInputs()", rada_attach.ClientID), true);
0
Arash On

You want to clear the list of items after Upload? if yes,according to this link you can do like this :

<script type="text/javascript">
   function clientFileUploaded(sender, args) {
       var count = sender._getRowCount();

       if (count > 2) {
           Array.removeAt(sender._uploadedFiles, 0);
           sender.deleteFileInputAt(0);
           sender.updateClientState();
       }
   }