使用Async Server调用的ASP.NET AJAX进度指示

时间:2022-12-16 13:22:21

I know this question has been asked before..a lot in fact. But I can't seem to get the wheels turning on this thing. To be honest I'm a bit lost on mating client side and server scripting and the examples I've seen are either far to simplistic or way above my head.

我知道之前已经问过这个问题......其实很多。但我似乎无法让车轮转向这件事。说实话,我在交配客户端和服务器脚本方面有点迷失,而我所看到的例子要么简单,要么远远超出我的想象。

Goal: My goal is to take a long running process I've writtin in VB.NET on the server, which happens to be loop based, and calculate a percentage complete (I know the range of the index values) and relay that back to the user by some means.

目标:我的目标是采取一个长期运行的过程,我在服务器上的VB.NET中编写,这恰好是基于循环的,并计算完成百分比(我知道索引值的范围)并将其转发回用户通过某种方式。

Idea: As the loop iterates I want to pass back up to the client an integer of percent complete or poll it from the client.

想法:当循环迭代时,我想向客户端传递一个完整百分比的完整或从客户端轮询它。

What I've done: Is very limited, I have little to no experience here, I've been doing a lot of googling and I've played with the UpdatePanel and UpdateProgress controls from AJAX a bit, but this method so far seems to lean towards an idicator, like GIF.

我做了什么:非常有限,我在这里几乎没有经验,我一直在做很多谷歌搜索,我已经玩了一些来自AJAX的UpdatePanel和UpdateProgress控件,但到目前为止这个方法似乎倾向于像GIF一样的idicator。

As always any help is appreciated, and if I can answer any questions I will.

一如往常任何帮助表示赞赏,如果我能回答任何问题,我会。

1 个解决方案

#1


1  

Have you considered using an inline frame (iFrame) to host your long running process and report back status to the client via the Response object of the long running .aspx page?

您是否考虑使用内联框架(iFrame)来托管长​​时间运行的进程,并通过长时间运行的.aspx页面的Response对象向客户端报告状态?

If so, then I suggest you read Easy incremental status updates for long requests.

如果是这样,那么我建议你阅读长期请求的Easy增量状态更新。

The example uses a button as the display for the progress after the user clicks it, but you could direct output to another DOM element if you wish.

该示例使用一个按钮作为用户单击它后显示的进度,但如果您愿意,可以将输出定向到另一个DOM元素。

#1


1  

Have you considered using an inline frame (iFrame) to host your long running process and report back status to the client via the Response object of the long running .aspx page?

您是否考虑使用内联框架(iFrame)来托管长​​时间运行的进程,并通过长时间运行的.aspx页面的Response对象向客户端报告状态?

If so, then I suggest you read Easy incremental status updates for long requests.

如果是这样,那么我建议你阅读长期请求的Easy增量状态更新。

The example uses a button as the display for the progress after the user clicks it, but you could direct output to another DOM element if you wish.

该示例使用一个按钮作为用户单击它后显示的进度,但如果您愿意,可以将输出定向到另一个DOM元素。