Datagrid to Excel Export Problem while adding summation values

S

Sudhakar

We are getting a strange problem in exporting data grid to excel.

We have a data grid in hand with basic data bounded to it and adding some summary data as DataGridItems rows at particular levels in datagrid (summation values)

When we export the grid to excel using the following code

Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("content-disposition", "attachment; filename=ProductVersionSummaryReport.xls");
Response.Charset = "";
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new HtmlTextWriter(tw);
hw.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Html);
reportGrid.RenderControl(hw);
hw.RenderEndTag();
Response.Write(tw);
Response.End();

This code is able to export the grid successfully to excel format except the summation rows….
It is able to create rows, columns (cells at exact location) but not able to display data in those cells.

What could be the mistake in this code?
 
A

Alvin Bruney [MVP]

typically, your summary rows occur in a footer which you build out in
itemdatabound. Is this the case? If it is, when you export it, it will not
be present in the dataset unless you manually add this final row to the
dataset.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,516
Members
44,983
Latest member
BuyX10BoostKeto

Latest Threads

Top