i am streaming an Excel file within a popup browser window. i am trying in vain to close the popup window once the "Download File" prompt has been sent. i tried adding a Javascript line to the end of my method to achieve this, but it doesnt work. I suspect because I have cleared the Response object.
can anyone help me achieve this annoying hurdle? thanks. my code is below.
private void ExportToExcel()
{
Response.Clear();
Response.Charset = String.Empty;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=" + rb.ReportTitle + ".xls");
this.EnableViewState = false;
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
phBody.RenderControl(hw);
Response.Write(sw.ToString());
Response.End();
Response.Write("<script language=javascript> { window.close() } /script>");
}
can anyone help me achieve this annoying hurdle? thanks. my code is below.
private void ExportToExcel()
{
Response.Clear();
Response.Charset = String.Empty;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=" + rb.ReportTitle + ".xls");
this.EnableViewState = false;
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
phBody.RenderControl(hw);
Response.Write(sw.ToString());
Response.End();
Response.Write("<script language=javascript> { window.close() } /script>");
}