I have a button who does the following:
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.csv");
Response.Charset = "";
Response.ContentType = "application/text";
//my content is created
Response.Output.Write(sb.ToString());
Response.Flush();
Response.End();
This is my button definition:
<asp:Button ID="Button1" runat="server" onclick="Excel_Click" Text="Export to Csv" onclientclick="ShowModal();"/>
As you can see I call a javascript function, who does the following:
function ShowModal() {
var divmodal = document.getElementById("divModal");
divmodal.style.display = '';
}
i.e. shows a modal window with the label "Loading" My problem is when I download the file I get the csv generated but after that my modal window still appears, that's because the page isn't being refreshed
Is there anything I can do?
Thanks in advance