This is a migrated thread and some comments may be shown as answers.

Exporting chart along with Grid

4 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
VEDA VIDVA NARAYANAN SATTANATHAN
Top achievements
Rank 1
VEDA VIDVA NARAYANAN SATTANATHAN asked on 22 Dec 2008, 07:03 AM
Hi,

I have two controls in a page
1. Chart Control
2. Grid control
I want to export both chart  and grid control to PDF or Excel format when exporting the data.
So that both the chart and grid are in the same file that is exported. Is there any way to do it?

I also have implemented custom paging in grid so that only the records equal to page size is fetched from the database each time the page index is changed. Is there a way to apply all the formatting (grouping, filtering,sorting) done by user on all the records when it is exported from grid.

Regards
Veda

4 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 22 Dec 2008, 09:44 AM

Hello VEDA VIDVA NARAYANAN SATTANATHAN,

About the Excel export of both controls:
Unfortunately this scenario is not supported. Each of RadGrid and RadChart has exporting methods, that concern only itself and no outer controls can be involved. You can use RadGrid tableview's ExportToExcel / ExportToWord methods and RadChart's Save method to export the controls separately and then you will need to additionally manipulate the files so that the image is added to RadGrid export.

About the PDF export of both controls:
I am afraid this scenario is not supported. The chart image is served by a http handler and this is not supported by RadGrid export mechanism.

I have notified our developers for this scenario, so they will consider providing support for it in a future version of RadControls. Please, accept our apologies for the inconvenience caused. Your Telerik points have been updated.

You can use the following workaround -- define a regular asp:Image control next to the chart. In ItemDataBound event of the grid call RadChart.Save method to save the chart as image, set the image's ImageUrl property to that image and hide the chart. This way RadGrid will have to export images and this scenario is supported out of the box.

Regarding your question about RadGrid custom paging and export:
I think that the approach presented in this topic from the documentation can help you in the development:
http://www.telerik.com/help/aspnet-ajax/grdexport.html (search for 'Export with custom paging')

Kind regards,

Sebastian

the Telerik team


Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Albert
Top achievements
Rank 1
answered on 15 Jan 2009, 02:41 AM
"You can use the following workaround -- define a regular asp:Image control next to the chart. In ItemDataBound event of the grid call RadChart.Save method to save the chart as image, set the image's ImageUrl property to that image and hide the chart. This way RadGrid will have to export images and this scenario is supported out of the box."

^ Can this be done without saving the image first to the hard disk?
0
Ves
Telerik team
answered on 19 Jan 2009, 09:59 AM
Hi Albert,

RadChart can be saved to a memory stream as opposed to writing to the disk. You can use the corresponding overload of RadChart.Save() method. However, you will need to manage this stream and show it as an image in the grid.

Regards,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Albert
Top achievements
Rank 1
answered on 19 Jan 2009, 10:04 AM
However, you will need to manage this stream and show it as an image in the grid.

^ Like I said, how exactly do I do that?
Tags
Grid
Asked by
VEDA VIDVA NARAYANAN SATTANATHAN
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Albert
Top achievements
Rank 1
Ves
Telerik team
Share this question
or