I want to disable a server side asp.net button control after click for some seconds & then fire a server side event. I am trying to use setTimeout but if I use setTimeout the server side event is never fired. Can anybody help?
<script type="text/javascript">
function disableBtn(btnId, dspTxt) {
var btn = document.getElementById(btnId);
btn.value = dspTxt;
setTimeout(btn.disabled = true,1000);
}
</script>
Place two buttons on your form:
First one is button that will be disabled after 2 seconds, second is button that will do the postback.
Next put this code inside page.cs:
Now just run the page and wait for 2 seconds and postback will occur and disable PostBackLinkButton.
If you don’t want that postback is visible to the user place buttons inside the updatepanel.