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

Display confirm on cancel upload.

4 Answers 145 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Freddy
Top achievements
Rank 1
Freddy asked on 20 Nov 2013, 02:35 AM
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

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Nov 2013, 07:26 AM
0
Freddy
Top achievements
Rank 1
answered on 26 Nov 2013, 04:18 PM
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.
0
Accepted
Hristo Valyavicharski
Telerik team
answered on 29 Nov 2013, 04:42 PM
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.
0
Massimiliano
Top achievements
Rank 1
answered on 31 Dec 2013, 05:27 PM
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();
}
Tags
AsyncUpload
Asked by
Freddy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Freddy
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Massimiliano
Top achievements
Rank 1
Share this question
or