2011-09-05 54 views
0

致電時我使用腳本經理不HttpContext的

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

Content-Disposition將提示用戶將內容保存到磁盤。它看起來不像你在這裏渲染頁面。只需將ExportDataString寫入流中即可。

你期待什麼發生?