问题描述
大家好!
我有一个GridView,它将显示绑定到GridView的数据库表XXXXX中的10条记录.当用户在浏览器中查看页面时,表XXXXX中又添加了5条记录,因此该表现在包含15条记录.显示GridView的页面应以这样的方式进行编程,例如在经过15秒的时间间隔后刷新GridView(或整个页面).
如何做到这一点?有人知道吗,请告诉我如何解决这个问题.
感谢您的宝贵时间!
由mohan.
Hi everybody!
I have a GridView which would display the 10 records that are in the database table XXXXX bound to the GridView. While the user is looking at the page in the browser another 5 records have been added to table XXXXX so that it now contains 15 records. The page displaying the GridView should be programmed in such a fashion that the GridView (or maybe the whole page) are refreshed say after an elapsed time interval of 15 seconds.
How can this be achieved? I anyone knows please tell me how to solve this.
Thanks for your time!
by mohan.
推荐答案
<script>
window.setTimeOut(windows.location.href=window.location.href, 5000);
</script>
http://www.w3schools.com/jsref/met_win_settimeout.asp [ ^ ]
http://www.w3schools.com/jsref/met_win_settimeout.asp[^]
<meta http-equiv="refresh" content="600">
http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm [ ^ ]
http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm[^]
- 创建一个将返回数据表(或可绑定到Gridview的其他对象)的Web服务.
- 创建一个调用Web服务的javascript函数
- 确保将此javascript代码以这样一种方式添加到呈现的HTML中:在将文档加载到浏览器中时执行该代码:setTimeOut("nameOfJavascriptFunction",10000);
- Create a webservice that will return a data table (or other object that is bindable to a gridview).
- Create a javascript function that calls the webservice
- Make sure this javascript code gets added into the rendered HTML in such a fashion that it is executed when the document has been loaded into the browser: setTimeOut("nameOfJavascriptFunction", 10000);
这篇关于如何在asp.net页面中设置基于时间的页面加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!