すべてのデータを Excel ファイルにエクスポートする際に問題があります。グリッドビューの最初のページからデータをエクスポートすることしかできませんでした。他のページも含めてデータをエクスポートする正しい方法を教えてください。本当にありがとう。
protected void bn_export_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition","attachment;filename=GridViewExport.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
gv_getGameDetails.AllowPaging = false;
//Change the Header Row back to white color
gv_getGameDetails.HeaderRow.Style.Add("background-color", "#FFFFFF");
gv_getGameDetails.HeaderRow.Cells[0].Style.Add("background-color", " #262626");
gv_getGameDetails.HeaderRow.Cells[1].Style.Add("background-color", " #262626");
gv_getGameDetails.HeaderRow.Cells[2].Style.Add("background-color", " #262626");
gv_getGameDetails.HeaderRow.Cells[3].Style.Add("background-color", " #262626");
this.RemoveControls(gv_getGameDetails);
gv_getGameDetails.RenderControl(hw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();