AJAX:状态栏:在函数执行时强制更新 UpdatePanel
我在更新面板内有一个标签,我想将其用作状态栏。
基本上,用户单击一个按钮来执行执行一系列任务的主要功能。我想通知用户函数的进展状态,例如:
阶段 1:检索数据...
阶段 2:计算值...
阶段 3:打印值...
阶段 4:完成!
我尝试直接从函数更新 updatepanel,但它仅在函数结束时更新面板(第 4 阶段)并显示“完成!” (我的理解是它应该如何工作)。
我一直在研究计时器和线程,尝试更新与主功能分开的面板,但我想我应该在这里发帖,以防有人有更好的想法?
I have a label inside an update panel which I would like to use as a status bar.
Basically the user clicks a button which executes a main function that performs a series of tasks. I'd like to inform the user as to the state of the function as it progresses e.g.:
Stage 1: Retrieving data...
Stage 2: Calculating values...
Stage 3: Printing values...
Stage 4: Done!
I've tried updating the updatepanel directly from the function but it only updates the panel at the end of function (stage 4) and shows "Done!" (which I understand is how it should work).
I've been looking into timers and threads to try and update the panel separate to the main function but I thought I'd post here in case anyone has any better ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否也在标签周围放置了更新面板?将 UpdateMode 设置为条件,然后在执行阶段时,设置标签的文本,然后 updatePanelProgress.Update() 应该执行此操作
Have you put an Update Panel around the label as well? Set UpdateMode to conditional, then when executing your stages, set the label's text then updatePanelProgress.Update() should do it