I have a loading image which is working fine
but when I add a download button to the form and
added code
Response.ClearContent();
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-Disposition", "attachment; filename=ssss.xls");
Response.WriteFile(uploadingFilePath & fileName)
HttpContext.Current.ApplicationInstance.CompleteRequest();
and I understood that when runs
Response.AppendHeader("Content-Disposition", "attachment; filename=ssss.xls");
line ,then the window.onload functions is not working
can anyone help me
Thanks in advance
The
window.onloadis a javascript function. The response you are writing now is an excel file.When you set the
ContentTypehttp header, you tell the browser that you are sending it an application file, and the browser will prompt the user to save the file to disk.Your page, and your javascript does not receive an events when the user is prompted or the file downloads.
There is no way to remove the loading image on an event if your response is a file.
You could remove it by setting a javascript
setTimeOut.Refer: setTimeOut
This will call the function
hideImageafter 5 seconds. Add it to your function that shows the image.