How to completely reset the AsyncUpload control

4 posts, 0 answers
  1. vandenbroele
    vandenbroele avatar
    17 posts
    Member since:
    Sep 2007

    Posted 24 Apr 2012 Link to this post

    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 !
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Apr 2012 Link to this post

    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.
  3. vandenbroele
    vandenbroele avatar
    17 posts
    Member since:
    Sep 2007

    Posted 24 Apr 2012 Link to this post

    Thanks you for the reply. Alas, our current production version of Telerik does not have the client method "deleteAllFileInputs".
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Apr 2012 Link to this post

    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.
Back to Top