Question

I am new to Telerik controls, in my code I am trying to Upload excel file using RadAsync upload. Code is working fine, but when user is trying to upload a file which is already opened in the background- I am getting javascript exception.

Is there is any way by which I can alert user in case file is already opened?

Était-ce utile?

La solution

You can use OnClientFileUploadFailed event of Telerik RadAsync Upload.

Something like

function OnClientFileUploadFailed(sender, args) {
    var upload = $find("<%= RadUpload.ClientID %>");
    var errormsg = args.get_message();
    var displaymsg = new String();
    sender.deleteFileInputAt(0);
    if (errormsg.search("[IO.IO_SharingViolation_File]") != -1) {
        displaymsg = "File: is currently in use. Please close the file and try again.";
    }
    else {
        displaymsg = "The file you selected is currently in use. Please close the file and try again.";
    }
    alert(displaymsg);
    args.set_handled(true);
}  
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top