0
Answer

Disable a button

Sanjeev

Sanjeev

17y
1.6k
1


I have a Save button on a web page.
I want to disable the button when clicked, so that the user does not click it more than once, as the serevr side code is being processed.
i disabled the button by calling a javascript function -
 btnSave.Attributes.Add("onClick","return buttonDisabled();") ;

In the Javascript file i have -
 function disableButton()
 {
  var btnSave = document.getElementById('btnSave') ;
  btnSave.disabled = true ;
  return true ;
 }

since the button gets disabled my server side code(in C#) does not get executed.
thanks a lot for any kind of help