I have an ASP.Net forms project in VS 2013. On a form I have an AJAX Timer control, TimerURL. It is disabled in the designer and has an interval of 1000 msec. It is not in an UpdatePanel and neither is the button from which I am calling it. I have tried to enable it from an ASP Button click using
TimerURL.Enabled = true;
After enabling, the Timer_Tick event does not fire.
I tried using javascript to enable and disable the timer with the following functions:
<script type="text/javascript">
function startTimer() {
$find('TimerURL')._startTimer()
}
function stopTimer() {
$find('TimerURL')._stopTimer()
}
</script>
I called these from the ASP button click event with
ScriptManager.RegisterStartupScript(this, this.GetType(), "startTimer", "<script>startTimer()</script>", false);
but the Tick event was not executed.
If I enabled the timer in design mode, the tick event code is periodically executed but I cannot stop the timer using TimerURL.Enabled = false or the above Javascript.
How can I enable or disable the AJAX timer control from an ASP button on an ASP.Net form?