数据库更改时如何通知/更新Gridview [英] How to Notify/Update Gridview when the Database changes

查看:124
本文介绍了数据库更改时如何通知/更新Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



感谢所有分享知识的人.

我在aspx页面中有一个Gridview,它显示了Intranet网络中各种计算机的数据.
我使用的框架将更新数据库中的所有机器信息. Gridview只是从数据库中获取数据并显示给用户.

如果发生任何更改,例如在数据库中添加了新的新行,或者更改了数据(机器详细信息,如IP或主机名).除非用户刷新页面,否则用户将无法查看更新的数据.

当数据库中发生更改时,有没有一种方法可以更新gridview/整个页面.

Hi,

Thanks to you all people who share their knowledge.

I have a Gridview in aspx page, it shows data of various machines in intranet network.
I am using a framework which will update all the machine information in the database. The Gridview just takes data from the DB and displays to user.

If any changes happens, like new new row is added in the database or the data is changed (machine details like IP or hostname). Unless the user refreshes the page, the user will not be able to see the updated data.

Is there a way we can update the gridview/the entire page when a change takes place in database.

推荐答案

有没有办法可以更新gridview /数据库中发生更改时的整个页面.
内部的计时器线程可以使用AJAX跟踪记录计数.但是,如果存在大量并发用户,这将影响性能.

因此,请在页面上执行固定的自动定期刷新或用户驱动的硬刷新按钮.
Is there a way we can update the gridview/the entire page when a change takes place in database.
A timer thread internally can keep track of the records count using AJAX. But this would affect performance if lots of concurrent users are present.

So, do a fixed automatic periodic refresh or a user driven hard refresh button on the page.


退后一步,了解它们在Web应用程序中的工作方式.
1)Web应用程序中的所有内容都基于请求/响应系统,不存在推送机制.
2)由于第1点,您必须从客户端驱动此同步.大多数人可能会使用一个系统,通过该系统定期与服务器进行检查,以查看是否有可用的更新.
Take a step back and understand how things work in web applications.
1) Everything in a web application is based on a request/response system, a push mechanism does not exist.
2) Because of point 1, you would have to drive this synchronization from your client. Most people would probably use a system by which they periodically check the with the server to see if any updates are available.


这篇关于数据库更改时如何通知/更新Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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