This is a migrated thread and some comments may be shown as answers.

How to set timeout on a RadButton in client-side

2 Answers 138 Views
Button
This is a migrated thread and some comments may be shown as answers.
Amy
Top achievements
Rank 1
Amy asked on 05 Apr 2011, 08:05 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 06 Apr 2011, 06:17 AM
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.
0
Amy
Top achievements
Rank 1
answered on 06 Apr 2011, 03:23 PM
Thank you Shinu, that was exactly what I needed!
Have a wonderful day :-)
Tags
Button
Asked by
Amy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Amy
Top achievements
Rank 1
Share this question
or