This is a migrated thread and some comments may be shown as answers.

How to completely reset the AsyncUpload control

3 Answers 209 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
vandenbroele
Top achievements
Rank 1
vandenbroele asked on 24 Apr 2012, 10:06 AM
Hello

I would like to know how to reset the control completely.

My upload control is in a popup (a simple absolute div) and has its own "Close" button. When the popup is closed, I want the Telerik control to completely reset, whether or not it is currently uploading or what state it is ...

I have tried using:
- deleteFileInputAt(0);
- _uploading = 0; i'm pretty sure this is not the way to go...
- _cancelUpload: this crashes a lot ... (stackoverflows etc....)

I'm searching for a reliable method to re-initialize the control like when the page was loaded.

Thanks !

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Apr 2012, 11:39 AM
Hi vandenbroele,

I tried the following code snippet to Reset a RadAsyncUpload while closing the Div.

ASPX:
<div id="simplediv" style="background-color:yellow;border:1px solid black;display:none;width:200px;height:200px;">
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server">
    </telerik:RadAsyncUpload>
    <asp:Button ID="close" runat="server" Text="close" OnClientClick="hideModal('simplediv');return false;" />
</div>
<asp:Button ID="show" runat="server" Text="show" OnClientClick="revealModal('simplediv');return false;" />

JS:
<script type="text/javascript">
    function revealModal(divID)
    {
        window.onscroll = function () { document.getElementById(divID).style.top = document.body.scrollTop; };
        document.getElementById(divID).style.display = "block";
        document.getElementById(divID).style.top = document.body.scrollTop;
    }
    function hideModal(divID)
    {
        document.getElementById(divID).style.display = "none";
        var upload = $find("<%= RadAsyncUpload1.ClientID %>");
        upload.deleteAllFileInputs();
    }
</script>
Hope this helps.

Thanks,
Princy.
0
vandenbroele
Top achievements
Rank 1
answered on 24 Apr 2012, 12:11 PM
Thanks you for the reply. Alas, our current production version of Telerik does not have the client method "deleteAllFileInputs".
0
Princy
Top achievements
Rank 2
answered on 25 Apr 2012, 05:20 AM
Hi vandenbroele,

I tried the above code in Telerik version 2012, 1, 215, 35. Please try upgrading to latest version. You can refer to Updating RadControls for ASP.NET AJAX to another version or license for more information.

Thanks,
Princy.
Tags
AsyncUpload
Asked by
vandenbroele
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
vandenbroele
Top achievements
Rank 1
Share this question
or