HELP: how to add clientscript disable the button after click button ?

  • Thread starter Thread starter Tee
  • Start date Start date
T

Tee

Hi,

I have a server side Button that with the code

Button3.Attributes.Add("onclick",
"javascript:document.all['Button3'].disabled=True; return false;")

but it don't work as it supposed to be, disable button and the return false
prevent it submit back to server.

anyone know how to fix it ?

thanks.
 
Try this..

put this function in your ASP

function DisableMe(ptrToControl

//Check if control is already disabled
if (!(ptrToControl.disabled))
//If if control is not disabled, Call Page_ClientValidate only if it exists
if(typeof(Page_ClientValidate) == 'function'
{
var isPageValid = new Boolean()
isPageValid= Page_ClientValidate();
ptrToControl.disabled=isPageValid ; //Assign Page_ClientValidate() result to control
return isPageValid

else //Page_ClientValidate does not exists

ptrToControl.disabled=true ; //Disable contro
return true

return false ; //Control is already disabled


put this in your code behin
Button3.Attributes.Add("OnClick", "javascript: return DisableMe(this)"

Let me know it this works

Thanx

Nimish
 
Back
Top