I have an ASP.Net web page which contains an ASP:Timer control
<asp:Timer ID="TimerRefresh" runat="server" Interval="5000" Enabled="true" OnTick="TimerRefresh_Tick">
</asp:Timer>
This is linked to by an asp:UpdatePanel in the page, so that a particular portion of the page is refreshed asynchronously.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="TopRow" id="TopRowPlace" runat="server">
... More HTML Code here...
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TimerRefresh" />
</Triggers>
</asp:UpdatePanel>
The issue is that the DIV tag containing the HTML which is updated asychronously can be hidden (by setting the display property to none in the style) when a user performs certains actions. When this happens there is no need for the content to be updated, because it is hidden.
Is there a way in JavaScript to disable the timer from running and doing the asynchronously post-back, and indeed, re-enabling it when the DIV tag is made visible again?