Thursday, July 5, 2012

How to disable Asp.Net button after been clicked

1st step: Create Java script function to disable the button and added to the web page


<script language="javascript">

function disableBtn(btnID, newText) {


var btn = document.getElementById(btnID);


setTimeout("setImage('"+btnID+"')", 10);


btn.disabled = true;


btn.value = newText;


}


</script>

2nd step:  Add script to the button

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

No comments:

Post a Comment