.net gridvieew导出excel表格自动启用迅雷下载页面问题
我用
public static void Out(Page p, Control c)
{
p.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
p.Response.Charset = "";
p.Response.ContentType = "application/ms-excel";
p.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new HtmlTextWriter(tw);
p.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("排名表.xls", System.Text.Encoding.UTF8));
c.RenderControl(hw);
p.Response.Write(tw.ToString());
p.Response.End();
}
这个函数将gridview数据导出EXcel表格的时候为老是启用迅雷,下载本页面,我点取消后,有时候会导出成功,有时候就不行,那个大侠遇到过这种为题,或者有好用的代码给我贴一个