Javascript 我想在ajaxToolkit:AjaxFileUpload开始上传时显示一条消息,有没有办法做到这一点
我想在ajaxToolkit:AjaxFileUpload开始上载时发送一条消息,默认情况下,是否有方法执行此操作。但是由于AjaxControlToolkit是一个开源库,您可以自己添加它。从以下页面下载最近的库源:,查找AjaxFileUpload控制源(/Server/AjaxControlToolkit/AjaxFileUpload文件夹),并将以下代码添加到AjaxFileUpload.cs文件中:Javascript 我想在ajaxToolkit:AjaxFileUpload开始上传时显示一条消息,有没有办法做到这一点,javascript,jquery,asp.net,ajaxcontroltoolkit,Javascript,Jquery,Asp.net,Ajaxcontroltoolkit,我想在ajaxToolkit:AjaxFileUpload开始上载时发送一条消息,默认情况下,是否有方法执行此操作。但是由于AjaxControlToolkit是一个开源库,您可以自己添加它。从以下页面下载最近的库源:,查找AjaxFileUpload控制源(/Server/AjaxControlToolkit/AjaxFileUpload文件夹),并将以下代码添加到AjaxFileUpload.cs文件中: [DefaultValue("")] [Category("Behavior")] [
[DefaultValue("")]
[Category("Behavior")]
[ExtenderControlEvent]
[ClientPropertyName("uploadStarted")]
public string OnClientUploadStarted
{
get
{
return (string)(ViewState["OnClientUploadStarted"] ?? string.Empty);
}
set
{
ViewState["OnClientUploadStarted"] = value;
}
}
之后,修改AjaxFileUpload.pre.js
文件:
// insert this code right after the _raiseUploadComplete method
add_uploadStarted: function (handler) {
this.get_events().addHandler("uploadStarted", handler);
},
remove_uploadStarted: function (handler) {
this.get_events().removeHandler("uploadStarted", handler);
},
_raiseUploadStarted: function () {
var eh = this.get_events().getHandler("uploadStarted");
if (eh) {
eh(this, Sys.EventArgs.Empty);
}
},
// modify the _doUpload method
_doUpload: function () {
if (!this._filesInQueue.length || this._filesInQueue.length < 1)
return;
this._raiseUploadStarted();
this._currentQueueIndex = -1;
if (!this._isFileApiSupports)
this._createIframe();
this._processNextFile();
}
//在_raiseUploadComplete方法之后插入此代码
add_uploadStarted:函数(处理程序){
this.get_events().addHandler(“uploadStarted”,handler);
},
remove_uploadStarted:函数(处理程序){
this.get_events().removeHandler(“uploadStarted”,handler);
},
_raiseUploadStarted:函数(){
var eh=this.get_events().getHandler(“uploadStarted”);
如果(eh){
eh(this,Sys.EventArgs.Empty);
}
},
//修改双倍加载方法
_双重负载:函数(){
如果(!this._filesInQueue.length | | this._filesInQueue.length<1)
返回;
这个;
这个._currentQueueIndex=-1;
如果(!this.\u isfileapi支持)
这个;
此._processNextFile();
}
然后构建解决方案并享受新功能。在AjaxControlToolkit的当前版本(2013年12月发布的7.1213版)中,此事件可供使用,无需任何源代码修改
看看这篇文章,它可能会对您有所帮助。。另外,这可能是一个好的开始+1我先是因为你的显示图像而犹豫是否投票给你,但后来我测试了它。你到底测试了什么?我发布的图像或解决方案?:)