问题描述
我想一个文件使用在AjaxControlToolkit一个AsyncFileUpload组件上载到服务器之后设置一个标签文本值。但是,它的接缝是无效的,虽然文件上传是上传后的绿色,上传作品。
保护无效AsyncFileUpload1_UploadedComplete(对象发件人,AjaxControlToolkit.AsyncFileUploadEventArgs E)
{
字符串文件名= System.IO.Path.GetFileName(AsyncFileUpload1.FileName);
AsyncFileUpload1.SaveAs(使用Server.Mappath(上传/)+文件名);
sourceLabel.Text =保存到+文件名; //这没有任何影响。我想这是因为该事件是异步的,但我怎么可以设置sourceLabel的价值?
}
该AsyncFileUpload控制用于存储文件递交所以控制所有的更新都将丢失隐藏帧。检查此链接和 uploadResult
标签的文本从 AsyncFileUpload1_UploadedComplete
方法如何改变引起注意:<一href=\"http://ajaxcontroltoolkit.$c$cplex.com/SourceControl/changeset/view/a2a6dc6854e0#SampleWebSites/AjaxControlToolkitSampleSite/AsyncFileUpload/AsyncFileUpload.aspx.cs\"相对=nofollow> Ajax控件工具包源$ C $ C
I am trying to set a label text value after a file is uploaded to the server using a AsyncFileUpload component in AjaxControlToolkit. But it seams it is ineffective, although the file uploader is green after the upload, and the upload works.
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
string filename = System.IO.Path.GetFileName(AsyncFileUpload1.FileName);
AsyncFileUpload1.SaveAs(Server.MapPath("Uploads/") + filename);
sourceLabel.Text="saved to "+filename; //this has no effect. I assume this is because the event is Async, but how can I set the value of sourceLabel?
}
The AsyncFileUpload control uses hidden frame for file submitting so all updates of controls will be lost. Check this link and draw attention how the uploadResult
label's text changed from AsyncFileUpload1_UploadedComplete
method: Ajax Control Toolkit source code
这篇关于AjaxControlToolkit AsyncFileUpload - 如何修改UploadedComplete事件标签文本值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!