ASP.NET - Countdown timer

feesu
feesu used Ask the Experts™
on
Hello Experts,

I have an aspx page that I want upon clicking on a button, from code behind I assign a certain number of minutes to a timer on the page.

The time should be displayed on a label in the page with a countdown.

For example, if my code behind variable holds the value of "5", clicking the button will make the label.text = 5, then it should work like a stopwatch (4:59 etc..) until 0:00

Is that possible?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015

Commented:
You can set the variable in code behind, but using code behind to decrement the variable would be impractical since it would require a postback every second. Your best bet is to do the decrementing on the client side with javascript.
attach this code to button:-

http://keith-wood.name/countdown.html
Systems Development / Support Specialist
Commented:
Please find attached code for Countdown timer
timer.js
timer.html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial