如何使用C#.net每5秒自动执行一次DataBind? [解决了] [英] How To auto DataBind in every 5 seconds with C#.net? [Solved]

查看:365
本文介绍了如何使用C#.net每5秒自动执行一次DataBind? [解决了]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想每5秒自动对GridView进行数据绑定.我的意思是自动刷新".我想每5秒从数据库中获取数据并绑定到GridView.请帮帮我..:doh:

I want to auto databind my GridView in every 5 seconds . I means "auto refresh". I want to get data from database and bind to GridView in every 5 seconds . Please Help me.. :doh:

推荐答案

您可以使用计时器控件执行此操作.
在计时器控件的Tick事件中,编写代码以从数据库获取数据并将其绑定到网格.
是的,timer控件带有AJAX扩展.
You can use a timer control to do this.
In the Tick event of the timer control, write the code to get data from database and bind it to the grid.
The timer control comes with AJAX extensions.


是的,您可以像AnkurM所说的那样使用Timer来解决问题,但那里的另一个选项是使用HTML META Tag.但会刷新整个页面.
Yeah, you can use Timer for your issue as like said by AnkurM, but another option there using HTML META Tag. but it will refresh the whole page.
<meta http-equiv="refresh" content="500">


这篇关于如何使用C#.net每5秒自动执行一次DataBind? [解决了]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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