简体   繁体   English

AjaxFileUpload OnClientUploadComplete和OnUploadComplete

[英]AjaxFileUpload OnClientUploadComplete & OnUploadComplete

I'm working on an application and I have a AjaxFileUpload control. 我正在开发应用程序,并且具有AjaxFileUpload控件。 I set OnClientUploadComplete to a javascript function and OnUploadComplete to a method in my code behind(.cs). 我在代码(.cs)后面的代码中将OnClientUploadComplete设置为javascript函数,将OnUploadComplete设置为方法。

In which order do these run? 这些以什么顺序运行? Or do they run in parallel? 还是它们并行运行?

In my OnUploadComplete i'm moving images from a tmp folder to a CDN. 在我的OnUploadComplete中,我将图像从tmp文件夹移动到CDN。 An in my OnClientUploadComplete i'm retrieving a new list of images, however, it doesn't seem to get the updated list unless i refresh the entire page. 在我的OnClientUploadComplete中,我正在检索图像的新列表,但是,除非刷新整个页面,否则它似乎不会获得更新的列表。 That is why i'm assuming these methods run in parallel. 这就是为什么我假设这些方法并行运行。

Is there a way to get the OnClientUploadComplete to run AFTER the OnUploadComplete is done? 有没有办法让OnClientUploadComplete在OnUploadComplete完成后运行?

You can use setTimeout() method in OnClientUploadComplete . 您可以在OnClientUploadComplete中使用setTimeout()方法。 So the method will be execute after completion of time provided in setTimeout() meanwhile OnUploadComplete will execute. 因此,该方法将在setTimeout()中提供的时间完成后执行,而OnUploadComplete将执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM