在没有UpdatePanel的情况下,自动在asp.net中刷新部分页面 [英] auto partial page refresh in asp.net without UpdatePanel

查看:59
本文介绍了在没有UpdatePanel的情况下,自动在asp.net中刷新部分页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在asp.net中自动刷新部分页面.有UpdatePanel,但它发送了太多数据.因此,我发现我可以制作一个Web服务并通过JavaScript代码调用它.但是我不知道如何自动调用网络服务.有许多示例显示了如何通过按钮单击事件来调用Web服务:

I want to make auto partial page refresh in asp.net. There is UpdatePanel but it sends too much data. So I've found that I can make a webservice and call it by the JavaScript code. But I don't know how to call webservice automatic. There are many examples showing how to call webservice by the button click event:

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?

推荐答案

只需使用 setInterval函数:

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

要重置自动呼叫,您可以在上使用 clearInterval 函数由 setInterval 返回的> id .

To reset automatic calls you could use the clearInterval function on the id returned by the setInterval.

这篇关于在没有UpdatePanel的情况下,自动在asp.net中刷新部分页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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