最近更新功能 [英] recent Update feature

查看:72
本文介绍了最近更新功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的Web应用程序中实现实时更新功能.每当我的表中发生状态更改(更新)时,我都需要在页面上继续显示它们.

解决方案

AJAX.这正是它的设计目的.您的页面将需要轮询服务器以请求更新,因为HTTP不会保持连接打开状态,以允许服务器在页面发送后与其进行通信.您可以使用JS计时器(setInterval或setTimeout)来执行此操作.您应该调用服务器脚本,该脚本返回有关已更改内容的信息,并且您的AJAX回调应解析该信息并相应地更新显示.

(您可以只让脚本发送表的完整新副本并覆盖整个元素,但是如果用户在其中滚动,选择等,就会出现问题.如果可以的话,最好将其更新到位.)但是,与ASP.net生成的HTML很好地配合使用可能会很难.)


您可以在固定的时间间隔后刷新页面以显示表中的记录,就像igoogle一样.而且,如果您不想刷新整个页面,则可以使用Ajax更新面板进行部分回发.

希望对您有所帮助:)

有关更多查询,请在此处评论!!

I need to implement a live update feature in my webapp. Whenever there is a status change (update) happening in my table i need to keep showing them on the page. What would be the best way to implement such feature?

解决方案

AJAX. This is exactly what it is designed for. Your page will need to poll the server to ask for updates, as HTTP doesn''t hold the connection open to allow servers to communicate with pages after they''re sent. You can do this with a JS timer (setInterval or setTimeout). You should call a server script which returns information about what has been changed, and your AJAX callback should parse that information and update the display accordingly.

(You can just have the script send a complete new copy of the table and overwrite the whole element, but that has issues if the user has scrolled, selected etc within it. It''s nicer to update in place if you can. Making that work nicely with the HTML that ASP.net produces might be hard, though.)


you can refresh the page after a fixed interval to display records from table just like igoogle. And if you don''t want to refresh the entire page you can use Ajax Update Panel to make partial postback.

hope it helps :)

for further queries comment here!!


这篇关于最近更新功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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