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
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,
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
^ Can this be done without saving the image first to the hard disk?
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.
^ Like I said, how exactly do I do that?