locked
UpdatePanel with Timer, enabled based on database value RRS feed

  • Question

  • User-1826049516 posted

    Hi,

    I have an UpdatePanel on each of my content pages. I want to add some form of timer control that can be enabled/disabled by getting the (boolean) value from the database on page load, as well as dynamically updating its Enabled/Disabled state with jQuery.

    So the process would be:

    full page load get true | false value from db for timer
    if enabled run every x seconds, if disabled do nothing
    somebody presses the Timer button that toggles the state in the database, and changes the state of the timer without a full page load/postback
    if that change is to Enabled begin the timer, if that change is to Disabled stop the timer, both without a full page load/postback

    If I use ASP.NET's Timer control, I can do the first part easily by populating the Enabled property with the value from the database. But, can client-side code dynamically change its state?

    I am already doing 'manual' jQuery UpdatePanel postbacks elsewhere using this, so I wonder if a custom jQuery timer would be better:

    page._doPostBack( 'ctl00$header$Search_Button', '' );

    But can I enable/disable such a timer dynamically as well, and on page load?

    Open to suggestions.

    Thanks

    Thursday, July 4, 2019 11:43 AM

Answers

  • User-1826049516 posted

    I went with the 2nd option as I needed a custom progress indicator to be activated. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 4, 2019 7:03 PM