AJAX:状态栏:在函数执行时强制更新 UpdatePanel

发布于 2024-09-01 10:33:16 字数 298 浏览 1 评论 0原文

我在更新面板内有一个标签,我想将其用作状态栏。

基本上,用户单击一个按钮来执行执行一系列任务的主要功能。我想通知用户函数的进展状态,例如:

阶段 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴情 2024-09-08 10:33:17

您是否也在标签周围放置了更新面板?将 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文