单击按钮后的状态/项目加载信息 [英] Status/Items Loading info after button click

查看:65
本文介绍了单击按钮后的状态/项目加载信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在ASP.net 2.0中有一个Web应用程序(使用Ajax),但遇到了问题.
我有一个按钮单击事件,大约需要60/70秒,并且添加了带有动画gif的Ajax UpdateProgress,但我希望有一个Label/文本面板来显示正在发出的请求.

想象一下,单击按钮后,我有一些功能正在运行,并且我想显示正在运行的功能以及运行状态.

示例:
一些伪代码:

Hi all,

I have a web application in ASP.net 2.0 (using Ajax), and I''m stuck with a problem.
I have an button click event, that is taking about 60/70seconds, and I added a Ajax UpdateProgress with a animated gif, but I would like to have a Label/text panel, to show what requeste is being made.

Imagine that after button click I have some functions running, and I want to show what function is running and the status on the fly.

Example:
some pseudo-code:

button click
{
showmessage(Function 1............... Loading)
Function1()
showmessage(Function 1............... Done)
showmessage(Function 2............... Loading)
Function2()
showmessage(Function 2............... Done)
showmessage(Function 3............... Loading)
Function3()
showmessage(Function 3............... Done)
showmessage(All Done)
}




在屏幕上,它会逐步显示,而不仅是在点击事件结束时显示




in the screen it will appear step-by-step, no only at the end of the click event

Function 1............... Loading
Function 1............... Done
showmessage(Function 2............... Loading)



有什么帮助吗?提示?
谢谢



Any help?tips?
Thank you

推荐答案

帮助!这很可能是肮脏的,但是如果您问我的意见,那不是一个好主意.实际上,您正在通过增加客户端和服务器之间的闲聊来降低性能.您不会发现与一个客户端有任何区别,但是如果有1000位用户访问您的站点,则此聊天会在服务器中带来严重的性能问题.一些网站提供了这种花哨的东西,它们会在另一端拥有高效的服务器.

现在,您的过程必须将进度/状态更新为特定于会话的变量.您需要使用javascript的 SetInterval方法以所需的时间间隔运行启用了ajax的javascript函数.由ajax脚本调用的页面读取会话变量并返回到客户端.

请注意,为此必须使用ajax调用来调用繁重的过程.表单发布无法使客户保持活动状态.
Help!. This is possible in a dirty way, but if you ask my opinion it is not a good idea. Actually you are degrading the performance by increasing the chatty between client and server. You wont find difference with one client, but if 1000s access your site, this chat gives significant performance issue in the server. Some sites offer this kind of fancy stuff where they would have efficient server on the other side.

Now the way is your process has to update progress/ status to session specific variable. You need to run a ajax enabled javascript function at desired intervals using javascript''s SetInterval method. The page called by the ajax script read the session variable and return to the client.

Note for this the heavy process has to be invoked using ajax calls. Form posting won''t work for keeping the client active.


这篇关于单击按钮后的状态/项目加载信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆