当我使用
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "TTTT111", "alert('calling dfdfd from server .....');", true);
在
之前或之后HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = strContentType;
HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", strFileName));
HttpContext.Current.Response.OutputStream.Write(ExportDataString, 0, ExportDataString.Length);
HttpContext.Current.ApplicationInstance.CompleteRequest();
HttpContext.Current.Response.OutputStream.Flush();
则不调用scriptmanager
Content-Disposition
将提示用户将内容保存到磁盘。看起来您并没有在这里渲染页面。正在将ExportDataString
写入流。
你期望发生什么?