我正在从gridview导出大量数据到Excel(2万行)。我无法导出此大数据集-该代码仅导出2400行。
string attachment = "attachment;filename=Itemofservice.xls";
Response.Clear();
Response.AddHeader("content-disposition", attachment);
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
System.Web.UI.WebControls.GridView Dgr_Select1 = new System.Web.UI.WebControls.GridView();
Dgr_Select1.DataSource = Ds.Tables["Itemofservice"];
Dgr_Select1.DataBind();
Dgr_Select1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();