Display confirm on cancel upload.

5 posts, 1 answers
  1. Freddy
    Freddy avatar
    25 posts
    Member since:
    Feb 2013

    Posted 19 Nov 2013 Link to this post

    Is it possible to display a browser confirm when the user click the cancel button of the asyncupload? I cant find a way to get the cancel click event.

    Thankyou
    Freddy
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Nov 2013 Link to this post

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Freddy
    Freddy avatar
    25 posts
    Member since:
    Feb 2013

    Posted 26 Nov 2013 Link to this post

    Hi telerik admins,

    Please give me a solution if this is possible. Have been waiting for an answer since a week? :-(

    I want to display a browser confirm if the user press cancel button when client uploading happens. If OK button is clicked upload should continue, and on Cancel click, cancel the upload.
  5. Answer
    Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 29 Nov 2013 Link to this post

    Hi Freddy,

    Yes it is possible. Please try to add the following javascript:
    <script type="text/javascript">
        Telerik.Web.UI.RadAsyncUpload.prototype._cancelUpload = function (row) {
            if (confirm('Do you want to cancel file uploading.')) {
                this._updateRowImage(row, "cancel");
                this._updateCancelButton(row);
     
                $(".ruFileProgressWrap", row).remove();
     
                this._uploadModule.cancel(row);
            }
        }
    </script>


    Regards,
    Hristo Valyavicharski
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  6. Massimiliano
    Massimiliano avatar
    185 posts
    Member since:
    Oct 2012

    Posted 31 Dec 2013 Link to this post

    I need something simplier. I just need to intercept the cancel client-side and if it's possible to get a reference to the RadAsyncUpload sender control of that cancel. Is this possible?
    What I need is something similar to:

    Telerik.Web.UI.RadAsyncUpload.prototype._cancelUpload = function () {
        $('#' + sender.get_id().replace('RadAsyncUpload1', 'AvatarLabel')).show();
        $(".AvatarUpload .ruInputs").hide();
        $(".AvatarImageAjaxLoading").show();
    }

    Is ok but how could I access the sender (i cannot resort to <% %> since I would like to put this in an external JS)
    Thanks

    EDIT SOLVED:
    I solved that way just in case anyone needs something similar:

    Telerik.Web.UI.RadAsyncUpload.prototype._cancelUpload = function (row) {
        $('#' + this.get_id().replace('RadAsyncUpload1', 'AvatarLabel')).show();
        $(".AvatarUpload .ruInputs").hide();
        $(".AvatarImageAjaxLoading").show();
    }
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017