如果m在.cs文件中使用响应对象,则不调用javascript函数

时间:2011-11-18 11:27:43

标签: javascript asp.net

我从我的代码后面调用了一个javascript函数,但是当我使用responce对象导出excel文件时,它只导出excel文件,而不是调用javascript函数。

Page.ClientScript.RegisterStartupScript(typeof(Page),“SymbolError”,

"<script type='text/javascript'>HidePopUp();</script>"); 





            //Cdoe to Export file

            Response.Clear();

            Response.Buffer = true;

            string filePath = "BrokerMemoData-" + DateTime.Now.ToString("dd") + DateTime.Now.ToString("MMM") + DateTime.Now.ToString("yy") + "_" + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + objDiaUserInfo.USER_ID.ToString() + ".xls";

            //Response.Write("<script type='text/javascript'>Javascript:alert('sdas');</script>");

            Response.ContentType = "application/vnd.ms-excel";

            Response.AddHeader("Content-Disposition", "inline;filename=" + filePath + "");

            //Get the physical path to the file.

            //string FilePath = @"C:\PivotalExcel\Data.xls";

            //Write the file directly to the HTTP content output stream.

            Response.WriteFile(sFileName);

            Response.End();

现在导出excel但不会调用javascript hide fun。

0 个答案:

没有答案