I have the following code to download a file from the server to the client, that occurs when the button btnSavetoDB_ExportToExcel is clicked, after that I want to have the button disable, how can I achieve that?
string fileName = newFN + ".xlsx";
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
Response.TransmitFile(DestFile);
Response.End();
btnSavetoDB_ExportToExcel.Enabled = false;
I noticed that the button did not become disable when placed the above code (Response), cause I had another code there and the button became disable with it. So it must be something related with the Response.
EDIT:
The button is within a ModalPopupExtender in case it matters.
I have found the solution to my problem, credit goes to: Dave Ward (click here)
this does the trick:
OnClientClick="this.disabled = true;"UseSubmitBehavior="false"