简体   繁体   English

没有UpdatePanel的asp.net中的自动部分页面刷新

[英]auto partial page refresh in asp.net without UpdatePanel

I want to make auto partial page refresh in asp.net. 我想在asp.net中自动刷新部分页面。 There is UpdatePanel but it sends too much data. 有UpdatePanel,但它发送了太多数据。 So I've found that I can make a webservice and call it by the JavaScript code. 因此,我发现我可以制作一个Web服务并通过JavaScript代码调用它。 But I don't know how to call webservice automatic. 但是我不知道如何自动调用网络服务。 There are many examples showing how to call webservice by the button click event: 有许多示例说明如何通过按钮单击事件来调用Web服务:

http://www.asp.net/ajax/videos/how-do-i-make-client-side-network-callbacks-with-aspnet-ajax http://www.asp.net/ajax/videos/how-do-i-make-client-side-network-callbacks-with-aspnet-ajax

How to do this by the interval? 如何按间隔执行此操作? Am I going in good direction? 我的方向是否正确?

Just use the setInterval function: 只需使用setInterval函数:

window.setInterval(function() {
    // code here will be called every 10 seconds
}, 10000);

To reset automatic calls you could use the clearInterval function on the id returned by the setInterval . 要重置自动调用,可以在setInterval返回的id上使用clearInterval函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM