I have a gried view data.
on export to excel click it return only .
Here is my code.
Response.Clear();
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
string FileName = "StockinhandDetails" + DateTime.Now + ".xls";
StringWriter strwritter = new StringWriter();
HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter); here return data
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
smallbanner1.GridLines = GridLines.Both;
smallbanner1.HeaderStyle.Font.Bold = true;
smallbanner1.RenderControl(htmltextwrtter);
Response.Write(strwritter.ToString());
Response.End();
Please help.


Yogesh GhorpadeRank #2,756 · 509 reputationPosted Jul 13, 2018, 1:36 AM EDT
Apurva SinghRank #6,113 · 276 reputationPosted Jul 13, 2018, 2:00 AM EDT