Using ASP.Net, JQuery, and BlockUI, I try to unlock the user interface after the file download dialog is displayed.
I block the user interface when I click the export button:
<script type="text/javascript">
$(document).ready(function(){
$('#<%= BtnExport.ClientID%>').click(function(){
$.blockUI();
});
});
</script>
After that, I create the file server side using:
private void SendFileToUser(byte[] file, string contentType, string filename)
{
Response.Clear();
Response.ContentType = contentType;
Response.AppendHeader("Content-Disposition", "attachment; filename="+filename);
Response.OutputStream.Write(file,0,file.Length);
Response.OutputStream.Flush();
Response.End();
}
After executing this code, I would like to unlock the interface.
I considered different options:
- A polling using Ajax causes whether a file has been generated.
- Store the file in the session and redirect it to the same page and then upload.
But both options seem true, and I think there must be a smart JavaScript way to get a handle or wait for a dialog with a file.
Any suggestions?
Dan