add this script inside the head event,
"<"script type ="text/javascript">
var timerEnabled = true;
function ToggleTimer(btn, timerID)
{
// Toggle the timer enabled state
timerEnabled = !timerEnabled;
// Get a reference to the Timer
var timer = $find(timerID);
if (timerEnabled)
{
btn.value = 'Pause';
// Start timer
timer._startTimer();
}
else
{
btn.value = 'Resume';
// Stop timer
timer._stopTimer();
}
}
</script>*
add an asp.net label control inside the update panel for testing
<asp:Label Id = "Label1" Text = "" runat="server"/>
add an html button outside the update pannel
<input type ="button" id = "btntimercontroller" value = "Pause" onclick ="return ToggleTimer(btntimercontroller,'<%= ajaxtimer.ClientID%>' );"/>
to check if the timer stops
add this code in aspx.cs file
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToLongTimeString();
}
Just omit the (") mark in the Script because it will cause an error...