How to set timeout on a RadButton in client-side

3 posts, 1 answers
  1. Amy
    Amy avatar
    105 posts
    Member since:
    Aug 2010

    Posted 05 Apr 2011 Link to this post

    Hi!  Is there a way to set a timeout for disabling a RadButton in the client-side?  I would like to disable a RadButton for 5 seconds after a user clicks on it. 

    Here's the current code I have:
    function DisableSubmitBtn() {
                var btnSubmit = $find('<% =btnItemSubmit.ClientId %>')
                btnSubmit.set_text("Submitting");
                btnSubmit.set_enabled(false)   
            }


    I've tried using the window.setTimeout function but it doesn't seem to have any effect.  I have tried both:
    setTimeout('document.getElementById("' + btnItemSubmit + '").disabled = false', 2000);
     
    var btnSubmit = $find('<% =btnItemSubmit.ClientId %>')

    setTimeout('btnSubmit.set_enabled(false)', 2000);


    Thanks!
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Apr 2011 Link to this post

    Hello Amy,
    Try the following client side code to achieve the same.
    <script type="text/javascript">
        var btnSubmit;
        function DisableSubmitBtn()
        {
          btnSubmit = $find('<% =btnItemSubmit.ClientID %>'
          setTimeout("change()", 5000)                
        }
        function change()
        {
            btnSubmit.set_enabled(false);
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Amy
    Amy avatar
    105 posts
    Member since:
    Aug 2010

    Posted 06 Apr 2011 Link to this post

    Thank you Shinu, that was exactly what I needed!
    Have a wonderful day :-)
Back to Top