none
asp:Timer is not fire on postback RRS feed

  • Question

  • I have a situation where i have two user controllers timer is working well once the page is loaded. But once i click on the button the timer is not working.


    RB

    • Moved by CoolDadTx Monday, August 12, 2019 1:40 PM ASP.NET related
    Sunday, August 11, 2019 6:09 PM

All replies

  • I think it's probably like this:

    ASP UI controls uses __doPostBack() method with the first parameter being the control name causing postback, so the server knows which component method to invoke.

    In your case you have 2 control competing for this parameter. Since your button is directly causing the postback it's selected, so your Timer control method is not triggered.

    I think you should find some other way to do what you want. In reality I never use asp:Timer because of such limitation, not to mention that in these AJAX days you should avoid causing full page reload except when absolutely needed. (Say, if you need to upload file in older version of IE, without the need for Flash support)

    Btw, try this workaround and see if it works for you. Although it's for different problem, this is valid replacement call for System.Web.UI.Timer.

    • Edited by cheong00 Monday, August 12, 2019 1:29 AM
    Monday, August 12, 2019 1:27 AM
  • Please post questions related to ASP.NET in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, August 12, 2019 1:40 PM