I going through some code that I inherited. The page has an update panel and in it there is a timer control.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:Timer ID="process" runat="server" Interval="1500" OnTick="process_Tick">
</asp:Timer>
</asp:UpdatePanel>
In code behind in the beginning of tick event of timer:
protected void process_Tick(object sender, EventArgs e)
{
process.Enabled = false;
the timer is disabled..most probably so that the tick is fired only once. Later in the event we have atleast two places where thread is put to sleep to intoduce some waiting in the processing:
Thread.Sleep(18000);
and also
Thread.Sleep(10 * 1000);
These two threads stops processing for a while but cause postbacks on different threads and tick event is fired on each thread….
How to stop these threads being created and firing the tick event again and again. Because of this code, a form is submitted couple of times.
Any help will be much appreciated.
Added the AsyncPostBackTimeout attribute to the ScriptManager. By default it timeouts after 90 sec. So by increasing the timeout, the timer’s Tick event was not triggered again and again.