Click here to Skip to main content
16,004,458 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i need countdown timer in asp.net using c#. because i used in online examination system . when i set 20 mins for over the examination the page redirect to another page i.e. result page. timer like 20mins set then time show in decreasing order 19,18,17,16.
Posted
Comments
R. Giskard Reventlov 15-May-12 13:29pm    
WE DON'T DO HOMEWORK!!!

 
Share this answer
 
Comments
Maciej Los 15-May-12 13:56pm    
Good links! +5
Sandeep Mewara 15-May-12 14:11pm    
Thanks losmac.
Either read this[^] or pay more attention in class or ask your tutor for some help.
 
Share this answer
 
Comments
rab Daniel 23-Apr-15 13:13pm    
-.-"
I did this for 2 seconds instead of 10 minutes (600000 milliseconds):
Timer t = new Timer(2000);
int timerCounter = 20;
t.Elapsed += delegate(object sender, ElapsedEventArgs args)
    {
        --timerCounter;
        if (timerCounter > 0)
        {
            Console.WriteLine("Counter = " + timerCounter + ", Time is " + DateTime.Now.ToLongTimeString());
        }
        else
        {
            Console.WriteLine("Time expired, Time is " + DateTime.Now.ToLongTimeString());
            // Whatever to do after timer expires
            t.Stop();
        }
    };
t.Start();
 
Share this answer
 
Comments
Sandeep Mewara 15-May-12 15:32pm    
Looks like this is an implementation for Winforms. OP is looking for ASP.NET.

I provided a MSDN link of Timer control for ASP.NET that has a working sample in it.
Clifford Nelson 15-May-12 20:16pm    
Actually I was doing in in a console.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900