ASP.NET Ajax 显示 UpdateProgress 控件最短时间
有时我的 ajax 请求太快,以至于用户没有意识到进行了 ajax 调用。所以我想强制 UpdateProgress 控件显示最短的时间,即使 ajax 请求已经完成。
例如:
John 浏览网站,ajax 调用需要 2 秒才能完成。我只希望 UpdateProgress 控件显示那 2 秒。
Mary 也浏览该网站,但 ajax 调用需要 > 0.5秒。所以我想显示 UpdateProgress 控件至少 1 整秒。
有人对如何做到这一点有任何想法吗?
编辑
我发现Telerik提供的AjaxLoadingPanel控件具有此功能。它有一个名为 MinDisplayTime 的属性,可以完成此操作。如果知道如何使用标准(免费)asp.net ajax 控件来完成此操作,那就太好了。
谢谢
Sometimes my ajax request is so fast that the user does not realize a ajax call was made. So I would like to force the UpdateProgress control to display for a minimum about of time, even if the ajax request has finsihed.
For example:
John browses the site and the ajax call takes 2 seconds to complete. I only want the UpdateProgress control to display for those 2 seconds.
Mary also browses the site but the ajax call takes > 0.5 seconds. So I want to display the UpdateProgress control for at least 1 full second.
Does anybody have any ideas on how to do this?
Edit
I have discovered that the AjaxLoadingPanel control offered by Telerik has this ability. It has a property called MinDisplayTime that does this very thing. It would be nice to know how to do this using the standard (Free) asp.net ajax controls.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在 Intranet 站点上工作时遇到了同样的问题,其中
UpdatePanel
内容更改得如此之快,以至于我无法在不进行调试或检查数据库的情况下判断是否发生了更新。我解决这个问题的方法是让 UpdatePanel 像以前一样做它的事情,但使用
UpdatePanelAnimationExtender
短暂地闪烁背景颜色的变化,例如,在淡出恢复正常之前,为用户提供某个动作已经发生的印象。如果这种情况发生得很快,比如 0.3 秒,并且选择了适当的“动作”颜色,那么这可能会非常有效。您需要获得 AJAX Control Toolkit,但如果您正在执行 Asp.Net AJAX 工作,那么如果您还没有的话,最好拥有它。
有关在
标记等中放置的内容,请参阅 Asp.Net Ajax Control Toolkit 站点页面 '使用动画'。I had the same problem working on an intranet site where the
UpdatePanel
contents changed so quickly that I couldn't tell if an update had happened without debugging, or checking the database.The way I tackled this problem was to let the UpdatePanel do its thing as before, but use an
UpdatePanelAnimationExtender
to briefly flash a change of background colour, for example, before fading back to normal, giving the user the impression that an action has happened. If this happens quickly, say 0.3 of a second, and an appropriate 'action' colour is chosen, this can be very effective.You'll need to get the AJAX Control Toolkit, but if you're doing Asp.Net AJAX work, you'll be better off having it, if you don't already.
For what to place within the
<OnUpdating>
tag etc., see the Asp.Net Ajax Control Toolkit site page 'Using Animations'.http://www.asp.net/Ajax/Documentation/Live/教程/ProgrammingUpdateProgress.aspx
http://www.asp.net/Ajax/Documentation/Live/tutorials/ProgrammingUpdateProgress.aspx
您可以通过跟踪服务器端代码执行所需的时间来解决后者(或者通过测量ajax执行时间可能更好,但这更棘手),
想法是这样的
you could work around the latter by keeping track of the time your server side code takes to execute (or perhaps even better by measuring the ajax execution time, but that's more tricky)
the idea is this