简体   繁体   中英

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.
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:

<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. Fixing that problem seemed to resolve this issue, and no one seemed inclined to comment, so this is being marked as closed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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