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

Problem with Cancel button

1 Answer 129 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 07 Apr 2014, 11:57 AM

Hi,

I have a problem with your RadAsyncUpload.

When a download a large file, I disable my save button. But, if I cancel my download, how to enable my save button ?

I use this even

$telerik.$(".ruCancel").on('click', function() {
    enableButtons();
});

for dectect the cancel button click, but if I use RadAsyncUpload
when download 2 large file simultaneous, If I cancel my first file, my save
button is enable, but the second file has not finished to downloading. 

Are you an event to detect the cancel button ? I use
OnClientFileUploadedFailed but is not fired when I cancel my download.

I check your demo, and this link

http://www.telerik.com/forums/how-to-trap-when-user-clicks-on-cancel-button

but it’s not works.

Browser used : IE9, Chrome, Firefox.

 
Thank’s

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Apr 2014, 05:19 AM
Hi Hans,

There is no event in RadAsyncUpload which will fire when the cancel button is clicked. Please try the following sample code snippet to achieve your scenario.

ASPX:
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" MultipleFileSelection="Automatic"
    OnClientFileUploading="OnClientFileUploading" OnClientFilesSelected="OnClientFilesSelected">
</telerik:RadAsyncUpload>
<telerik:RadButton ID="RadButton1" runat="server" Text="Save">
</telerik:RadButton>

JavaScript:
<script type="text/javascript">
    var selectedFiles;
    function OnClientFilesSelected(sender, args) {
        selectedFiles = args.get_count();
    }
    function OnClientFileUploading(sender, args) {
        var btn = $find("<%=RadButton1.ClientID %>");
        btn.set_enabled(false);
        $telerik.$(".ruCancel").on('click', function (e) {
            selectedFiles--;
            if (selectedFiles == 0)
                btn.set_enabled(true);
        });
    }
</script>

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