超时后如何在asp网页中自动刷新页面 [英] how to page auto refresh in asp net after timeout

查看:139
本文介绍了超时后如何在asp网页中自动刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

超时后如何在asp网页中自动刷新。



我需要在3分钟后自动刷新我的网页。任何人都可以帮助我。页面刷新后我想要

自动绑定gridview中的数据。



谢谢。

how to page auto refresh in asp net after timeout.

I need to auto refresh my webpage after 3 min. any one can help me.After page refresh i want
automatically bind a data in my gridview.

Thank you.

推荐答案

为什么要重装整页?



而是尝试重新加载gridview。你可以使用AJAX或jQuery。检查这些



GridView 放在 UpdatePanel 中。并使用计时器进行刷新。

计时器控制概述 [ ^ ]

教程:如何以定时间隔刷新UpdatePanel控件 [ ^ ]



这里jQuery示例

每隔10秒刷一个div [ ^ ]
Why are reloading entire page?

Instead try to reload the gridview. You could use AJAX or jQuery. Check these

Put your GridView inside UpdatePanel. And use Timer for Refresh.
Timer Control Overview[^]
Tutorial: How to refresh an UpdatePanel control at a timed interval[^]

Here jQuery sample
Refresh a div at every 10 seconds[^]


在主页面的标题部分下添加此标记



Add this tag under header section in your master page

<meta http-equiv='refresh' content='9000;url='yourpage.aspx' />





内容是指以秒为单位的时间。



url,你需要刷新的页面在某个时间间隔



content refers the time in seconds.

url, the page which u needs to be refreshed in certain time interval


< meta http-equiv ='refresh'content ='5000'/>

//在内容中提及所需的毫秒数,以给定的ms间隔刷新当前页面。



其他方法是:

<meta http-equiv='refresh' content='5000' />
//Mention required milli seconds in content,which refresh your current page at the given interval of ms.

Other way to do that is:
setTimeout(function() {
 location.reload();// load your page after every 5 seconds
}, 5000);





5000以毫秒为单位,您可以根据您的要求提及时间..



5000 is in milliseconds you can mention the time as per your requirement..


这篇关于超时后如何在asp网页中自动刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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