我正在尝试将数据网格导出到 Excel。使用代码。
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Salary_JV_Posting_For_PG_.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
stringWrite.Write(" <b><font color=#336699 size = 25px><u>test</u></font></b> ");
stringWrite.Write(Environment.NewLine);
stringWrite.Write(Environment.NewLine);
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
Response.Flush();
dgLine.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
我尝试调试,但是当执行最后一行(response.end)时出现以下错误
Data = Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
我正在使用 AJAX。
问候库马尔