Saturday, June 12, 2010

asp.net: How to disable asp.net button after clicked

1st step: Create Java script function to disable the button



function disableBtn(btnID, newText) {
var btn = document.getElementById(btnID);
setTimeout("setImage('"+btnID+"')", 10);
btn.disabled = true;
btn.value = newText;

}

2nd step:
Call onclientclick action for the button

OnClientClick="disableBtn(this.id, 'Upload data ')" UseSubmitBehavior="false"

No comments:

Post a Comment