Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Sudhakar #1
Datagrid to Excel Export Problem while adding summation values
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?
Sudhakar Guest
-
DataGrid data Export to Excel
I know we all have users asking "Can I Export/Import to Excel?". Apparently Excel is the best thing to come along to the user community since large... -
Export Datagrid to excel
Hi, I have written the code to export my datagrid to excel. it is working fine. But i have one issue, when ever i click on export button, it... -
Display a Datagrid & Export a Datagrid to Excel
I have a page displaying a datagrid and the user wants to have two options: 1. Export the current "Displayed" datagrid to Excel 2. Export another... -
DataGrid export to excel
I've asked this question once before, but am still having problems. When I try to export this grid to excel i get the error message i've seen... -
Embedded Datagrid Export to Excel...
I have a Datagrid within a Datagrid within a Datagrid. I have successfully exported a single datagrid to excel, but when I use the same approach on... -
Alvin Bruney [MVP] #2
Re: Datagrid to Excel Export Problem while adding summation values
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.
--
Regards,
Alvin Bruney
[ASP.NET MVP [url]http://mvp.support.microsoft.com/default.aspx][/url]
Got tidbits? Get it here... [url]http://tinyurl.com/27cok[/url]
"Sudhakar" <sudhakarATgmail.com_nospam> wrote in message
news:6F21E1FC-B8D5-4C15-99A4-9426B7995875@microsoft.com...> 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?
>
Alvin Bruney [MVP] Guest



Reply With Quote

