间隔2分钟后如何调用函数? [英] How to call a function after 2 minutes interval?

查看:118
本文介绍了间隔2分钟后如何调用函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的网页在那里,我有一个数据列表,应该每隔几分钟就绑定一次.

请给出正确的方法.

谢谢
Seema

Hi,
I have web page there I have a data list that should be bind at every minutes interval.

Please give the correct way to do this.

Thanx
Seema

推荐答案

我现在可以想到的方法之一是...为此使用Javascript.
您将需要使用setInterval UpdatePanel/PageMethod/CallBack.

对于 setInterval ,它在指定的延迟后触发,并在相同的延迟后再次触发,直到被取消.:
http://www.howtocreate.co.uk/tutorials/javascript/timers [ ^ ]

您可以在此处选择任何一种AJAX方法.基于页面中的setInterval函数,您可以一次又一次重新绑定数据列表.
例如,如果您选择更新面板":在面板内部有一个虚拟按钮以及数据列表.在setInterval javascript函数中单击按钮.更新面板得到部分刷新
One of the ways i can think of right now is... using Javascript for it.
You would need to use setInterval and UpdatePanel/PageMethod/CallBack.

For setInterval that fires after the specified delay, and keeps firing again after the same delay, until it is cancelled.:
http://www.howtocreate.co.uk/tutorials/javascript/timers[^]

you can pick any one of the AJAX methods here. Based on the setInterval function in your page, you can re-bind datalist again and again.
For example if you choose Update Panel: Have a dummy button inside panel along with datalist. Fire the button click in the setInterval javascript function. Update panel get partial refresh


使用定时器控件 [ ^ ].
Timer_Tick事件上,编写代码以从数据库获取新数据并将其绑定.

希望这会有所帮助!
Use a Timer Control[^].
On the Timer_Tick event, write the code to get the fresh data from database and bind it.

Hope this helps!


函数Update()
{
setTimeout("__ doPostBack(" CountrolID,"'')," TimeDelayInMilliseconds);
}
& lt;/script& gt;
function Update()
{
setTimeout("__doPostBack(''CountrolID'','''')","TimeDelayInMilliseconds");
}
</script>


这篇关于间隔2分钟后如何调用函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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