You must Sign In to post a response.
  • Category: ASP.NET

    How to start timer on button click ?

    Are you looking for a way to start timer on button click ? then read this thread to know more about it

    I have simple timer of 10 minutes. But it creates a problem. Whenever i click on button, the timer starts again from starting. It is not properly working. the project is of online examniation system

    Help me out
  • #743963

    Before starting the timer on the button click.
    Check the state of timer if the timer is stop then start it.
    Else do nothing.

    Hope this helps you


  • #743983

    The problem could be coming due to Button click is posting back which is causing the Time to restart everytime.

    You keep the Timer in a UpdatePanel and keep the update mode as Conditional as shown so that it will start <asp:UpdatePanel runat="server" UpdateMode="Conditional">

  • #743998
    Hai Rutul,
    I think its better to use the JavaScript for the timer part as it will improve the response time of the application.
    You can start the timer on the bodyload of the form.
    See below fothe refernce link toimplement it:

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • #744016
    Dear Padmasri Vemuri

    I have already kept timer in update panel with update mode as conditional
    still it is not working

  • #744046

    Go through the below mentioned links.. This may help u lot..





  • #744059

    protected void Button1_Click(object sender, EventArgs e)
    System.Timers.Timer _timer;
    _timer = new System.Timers.Timer(10000);
    _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
    _timer.Enabled = true;

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • Sign In to post your comments