当我使用
时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。
答案 0 :(得分:0)
Content-Disposition
将提示用户将内容保存到磁盘。它看起来不像你在这里渲染页面。只需将ExportDataString
写入流。
你期待发生什么?