避免在GridView上进行分页(在按钮上(导出时))

时间:2010-03-04 10:46:43

标签: c# asp.net gridview export

protected void Button3_Click(object sender, EventArgs e) //export
{
    GridView2.AllowPaging = false;
    GridViewExportUtil.Export("Сводка.xls", this.GridView2);
    GridView2.AllowPaging = true;
}

我需要避免对XLS导出进行分页: - /

1 个答案:

答案 0 :(得分:2)

你可以达到这样的目的......请试一试

protected void btnExportExl_Click(object sender, EventArgs e)
{
    grd.Allowpaging = false;
    grd.DataBind(); // you need to rebind the gridview
    grd.RenderControl(htw);
    Response.Write(sw.ToString());
    Response.Flush();
    Response.End();

    grd.Allowpaging = true;//Again do paging to gridview
    grd.DataBind();
}