脚本管理器不使用HttpContext调用

时间:2011-09-05 10:11:14

标签: c# asp.net

当我使用

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。

1 个答案:

答案 0 :(得分:0)

Content-Disposition将提示用户将内容保存到磁盘。它看起来不像你在这里渲染页面。只需将ExportDataString写入流。

你期待发生什么?