this script has to be placed in the page where the button has to be disabled.
Paste the script below the script manager
This function used to disable the button when the server side button is
clicked and after all other validations.
<script language="javascript" type="text/javascript">
//Set function to execute when the event occurs
..Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
//The function which will disable the button
function BeginRequestHandler(sender, args)
{
document.getElementById("$lt%=btnSave.ClientId %>").disabled=true;
//Insert here the script that needs to be executed
//before the request is sended to the server
}
</script>
//Set function to execute when the event occurs
..Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
//The function which will disable the button
function BeginRequestHandler(sender, args)
{
document.getElementById("$lt%=btnSave.ClientId %>").disabled=true;
//Insert here the script that needs to be executed
//before the request is sended to the server
}
</script>
Add This in WebConfig File
<httphandlers>
<add validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" path="ScriptResource.axd" verb="GET,HEAD">
</httphandlers>
<httpmodules>
<add type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="ScriptModule">
</httpmodules>
<add validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" path="ScriptResource.axd" verb="GET,HEAD">
</httphandlers>
<httpmodules>
<add type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="ScriptModule">
</httpmodules>
No comments:
Post a Comment