bind the grid view data into excel sheet

Posted by Subbaniadu under ASP.NET on 4/15/2012 | Points: 10 | Views : 2890 | Status : [Member] | Replies : 3
bind the grid view data into excel sheet

c.s.naidu


Responses

Posted by: Hariinakoti on: 4/15/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Naidu,
follow this link.
http://www.aspdotnet-suresh.com/2011/04/how-to-export-gridview-data-to-excel-or.html

Thanks & Regards
Hari

Subbaniadu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Veerac85 on: 4/17/2012 [Member] Starter | Points: 25

Up
0
Down
this is pretty easy to do in the DOTNET world. All you have to do is set the contenttype of the response to excel and write the html output to the buffer.
private void ExportToExcel()
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Products.xls");
Response.Charset = String.Empty;
Response.ContentType = "application/ms-excel";
StringWriter stringWriter = new StringWriter();
HtmlTextWriter HtmlTextWriter = new HtmlTextWriter(stringWriter);
gvProducts.RenderControl(HtmlTextWriter);
Response.Write(stringWriter.ToString());
Response.End();
}
For complete details and explanation of the process, go to this link http://technico.qnownow.com/2012/04/06/export-data-from-asp-net-gridview-control-to-excel/

Subbaniadu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bugwee on: 4/18/2012 [Member] Starter | Points: 25

Up
0
Down
i think, this is what you wanted

http://www.aspsnippets.com/Articles/Read-and-Import-Excel-Sheet-into-ASP.Net-GridView-Control.aspx

Subbaniadu, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response