Website timer tick makes buttons unresponsive

Posted on 2014-08-28
Last Modified: 2015-04-25

I have a ASP.NET C# website which has a timer that ticks every 0,8 seconds. When it ticks, it gets a value from an SQL database, and updates a textbox (which is in an UpdatePanel) with the new value. This part works well, and the value on the screen is updated fairly smoothly. I disable the timer at the start of its tick and enable it again when the value in the textbox have been updated to avoid "double-ticks" if the sql server responds to slow.

My problem is that I have several buttons on my site, and they do not always responed when they are clicked. If I increase the time between timer ticks, the problem with unresponsive buttons goes away, so I supect that the unresponsiveness of the buttons are due to the site being busy with handling the timer tick.

UPDATE: The buttons DO respond to clicks, but with the timer set to 0,8 seconds, they respond very slowly (I guess they are waiting for the timers Tick event to finish).

Is there a way around this? I cannot make the timer tick less frequently, as I need the value from the database to be shown in as "real time" as possible.
Question by:poultarp
    LVL 77

    Expert Comment

    by:David Johnson, CD, MVP
    run the timer asyncronously not syncronously or in its own thread and not in the UI thread.
    LVL 1

    Accepted Solution

    Problem was solved by moving all code on button click into JQuery/JSON.
    LVL 1

    Author Closing Comment

    The problem was resolved with out using the single input from user on site.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Live - One-on-One C# Help from Top Experts

    Solve your toughest problems, fast.
    C# experts are online now and ready to help you.

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video discusses moving either the default database or any database to a new volume.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now