简体   繁体   English

ASP.NET Timer + UpdatePanel:如何停止连续注册事件?

[英]ASP.NET Timer + UpdatePanel: How do I stop the event from continually registering?

I have probably worded the question badly, but couldn't figure out how to phrase it. 我可能对这个问题的措辞很差,但无法弄清楚该如何表达。
I have an ASP.NET webpage with a number of update panels and timers to trigger events, but it seems I must be missing something in my implementation, because the behaviour I'm observing can't be right. 我有一个ASP.NET网页,其中包含许多更新面板和用于触发事件的计时器,但是似乎我在实现中一定缺少某些内容,因为我观察到的行为不正确。
I've noticed that every time my Timer fires a tick event I get a new script tag in the <head> section of my page with the following code: 我注意到,每次我的计时器触发一个滴答事件时,我都会在页面的<head>部分中获得一个新的脚本标签,其中包含以下代码:

<script type="text/javascript">
    Sys.Application.add_init(function() {
        $create(Sys.UI._Timer, {"enabled":true,"interval":1000,"uniqueID":"ctl00$ContentPlaceHolder$missionControl$missionDataControl$MissionTimer"}, null, null, $get("ctl00_ContentPlaceHolder_missionControl_missionDataControl_MissionTimer"));
    });
</script>

I figure that code should be added to the page on the first load, but it shouldn't keep duplicating, should it? 我认为应该在第一次加载时将代码添加到页面中,但是它不应该一直重复,应该吗? It's probably something really basic, but what am I missing? 这可能是非常基本的东西,但是我想念的是什么?

There was something causing an update within an UpdatePanel where it shouldn't have been, and was causing some unusual updating duplication. 某个原因导致了不应在UpdatePanel中进行的更新,并且导致了一些异常的更新重复。 Fixing that problem seemed to resolve this issue, and no one seemed inclined to comment, so this is being marked as closed 解决该问题似乎可以解决此问题,而且似乎没有人愿意发表评论,因此已被标记为已关闭

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

相关问题 如何覆盖Asp.Net UpdatePanel添加的(动态)Javascript函数? - How do I overwrite a Javascript function added (dynamically) by Asp.Net UpdatePanel? 如何使客户端脚本在ASP.NET回发上执行? (来自UpdatePanel) - How do you get client-side script to execute on an ASP.NET postback? (from an UpdatePanel) ASP.Net如何从弹出窗口更新主页中的updatePanel? - ASP.Net How to update a updatePanel in main page from popup? 如何在ASP.net上正确使用启动和停止计时器? - How to properly use start and stop timer on ASP.net? 如何获取ASP.NET page_load事件以触发AJAX UpdatePanel更新 - How to get an ASP.NET page_load event to trigger AJAX UpdatePanel update 如何在setInterval ajax Web服务调用中停止ASP.net表单身份验证/会话更新? - How do I stop ASP.net forms authentication / session from renewing in setInterval ajax web service call? 如何在ASP.NET页中实现倒数计时器? - How can I implement a countdown timer in an ASP.NET page? ASP.NET 4.0:我无法弄清楚UpdatePanel如何更新图像控件 - ASP.NET 4.0: I cannot figure out how an UpdatePanel is updating an image control 在updatepanel刷新时从asp.net代码后面更改javascript变量 - Change javascript variable from asp.net codebehind on updatepanel refresh ASP.NET UpdatePanel阻止jQuery滑块更新 - ASP.NET UpdatePanel preventing jQuery slider from updating
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM