我是Telerik控件的新手,在我的代码中我尝试使用RadAsync上传来上传excel文件。 代码工作正常,但当用户尝试上传已在后台打开的文件时 - 我收到了javascript异常。
如果文件已经打开,我是否有办法提醒用户?
答案 0 :(得分:0)
您可以使用Telerik RadAsync上传的OnClientFileUploadFailed
事件。
像
这样的东西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);
}