I'm writing data into an excel and after completion I'm downloading the excel sheet.
This is my code for downloading
byte[] fileBytes = System.IO.File.ReadAllBytes(excelPath);
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.AppendHeader("content-length", fileBytes.Length.ToString());
context.Response.ContentType = "application/octet-stream ";
context.Response.AppendHeader("content-disposition", "attachment; filename=" + "ExcelSheet.xls");
context.Response.BinaryWrite(fileBytes);
context.ApplicationInstance.CompleteRequest();
After completion of this I'm calling my JavaScript for Popup
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
lblLog.Text = "Successfully Downloaded";
But it is not showing the popup. If I remove the code for download it is working perfectly.What should I do to downlod and get poup.
Aucun commentaire:
Enregistrer un commentaire