首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

GridView导出大量数据时疏失,报该页无法显示了

2013-04-09 
GridView导出大量数据时出错,报该页无法显示了导出EXCEL按钮的原码如下:protected void ToExcel_Click(obj

GridView导出大量数据时出错,报该页无法显示了
导出EXCEL按钮的原码如下:
    protected void ToExcel_Click(object sender, EventArgs e)
    {
        Response.ClearContent();
        Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
        Response.ContentType = "application/excel";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        gv_MO_Display.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
    }
[解决办法]
Refer this:
http://www.cnblogs.com/insus/articles/2002489.html

热点排行