Member Avatar

Hi,

I am having a Timer control like this:

asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="1000" OnTick="Timer1_Tick">                                                                              </asp:Timer>

In an UppdatePanel with AJAX enabled.
So everything works fine to the point where on each refresh of the panel a JS is inserted in the header:

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

So you can imagine in 10 min the page is increased by 600 lines.

Any ideas on how to make the timer not register itself every time or at least not stack up ?

Thanks!

Hi,

I am having a Timer control like this:

asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="1000" OnTick="Timer1_Tick">                                                                              </asp:Timer>

In an UppdatePanel with AJAX enabled.
So everything works fine to the point where on each refresh of the panel a JS is inserted in the header:

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

So you can imagine in 10 min the page is increased by 600 lines.

Any ideas on how to make the timer not register itself every time or at least not stack up ?

Thanks!

http://disturbedbuddha.wordpress.com/2007/11/26/controlling-the-aspnet-timer-control-with-javascript/

I don't suppose you ever found a solution for this?

I'm experiencing the same exact issue of a usercontrol with a timer control in it creating duplicate javascript calls to the timer whenever it fires.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.