Can Javascript disable an ASP.net control inside a UserControl? My Javascript file is called from the MasterPage, I've also tried it from the ContentPage.
I'm attempting to use Javascript as an idle timer to reduce server postbacks without logging the users out. When the user goes back to focus on the window the timer restarts and refreshes again until the user is idle for 30 minutes and it pauses the ASP.Net timers.
Javascript:
var timer = $find('<%= TimerAutoRefresh.ClientID %>');
if (timer) {
//stop the timer
timer._stopTimer();
timer.set_enabled(false);
console.log("Timer disabled: " + timer);
}
ASP.net ASCX
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
<asp:Timer ID="TimerAutoRefresh" runat="server" Interval="5000" Enabled="true"></asp:Timer>
<asp:Literal ID="LiteralTest" runat="server">Timestamp</asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
I've tried $find and document.getElementById and have not been able to get the ID. When I use ClientIDMode="Static"
the page fails to refresh every 5 seconds as it does a complete postback.