I am using silverlight RadGridView with paging. I want to export the gridview content to excel/csv. I have done that task but the gridview is exporting only the current page. I want not only the current page, but all the pages to be exported to excel.
Can any one please help me in this regard?
Thanks in advance,
Shankar
19 Answers, 1 is accepted
What is the source of the datapager?
Usually, you need to set the PageSize property of the data pager to 0 before calling the Export method.
After the export is done you need to set the PageSize back to its original value.
Note that if the pager is bound to DomainDataSource then you need to set the PageSize to 0 of the domain data source itself.
Hope this helps.
All the best,
Veskoni
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
We have a new demo about Exporting Row Details. I believe the approach shown there will help you achieve your goals.
Best wishes,
Veskoni
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I encountered the issue with performance when I tried to export the grid of 1000 rows by using Exporting function of RadGridView. It was very very slow. Note: I did the test with 1000 rows already be rendered to the RadGridView.
Please help to assist on it.
Thanks and regards,
Adrian
I tested the export with 2000 rows locally and it was very fast.
Can you please open a support ticket and attach a simple project so I can debug it?
Thanks
Greetings,
Veskoni
the Telerik team
I'm basing my code from the GridView Exporting Paged Data example of your web site Demo.
Please Advise
I have just posted an answer to your inquiry in the other thread you have opened. In order to keep a fruitful and consistent dialogue, I would kindly ask you to carry out any further communication there. Thank you.
Kind regards,
Ivan Ivanov
the Telerik team
I used the following code, now i can able to export all records in my RadGridView to Excel sheet with no change in RadDataPager
lets try this........ch@ndu
RadDataPagerRadGrdWorkOrders.PageSize = 0;
using (Stream stream = dialog.OpenFile())
{
GridViewExportOptions exportOptions = new GridViewExportOptions();
exportOptions.Format = format;
exportOptions.ShowColumnFooters = true;
exportOptions.ShowColumnHeaders = true;
exportOptions.ShowGroupFooters = true;
RadGrdWorkOrders.Export(stream, exportOptions);
}
RadDataPagerRadGrdWorkOrders.PageSize = 20;
i got the same problem, that if i got multiple pages on my Grid, not all of the Data is Exportet - just the Data on the first Page
is getting exported.
So here's my Export Function which i call:
public static void ExportData(GridView grid) { string extension = "xls";
grid.PageSize = 0;
ExportFormat format = ExportFormat.Html; SaveFileDialog dialog = new SaveFileDialog(); dialog.DefaultExt = extension; dialog.Filter = String.Format("Excel Files (*.{0})|*.{0}|Alle Files (*.*)|*.*", extension); dialog.FilterIndex = 1; if (dialog.ShowDialog() == true) { using (Stream stream = dialog.OpenFile()) { GridViewExportOptions exportOptions = new GridViewExportOptions(); exportOptions.Format = format; exportOptions.ShowColumnFooters = false; exportOptions.ShowColumnHeaders = true; exportOptions.ShowGroupFooters = false; grid.Export(stream, exportOptions); } } }
So is set the PageSize for every time any Grid Export something.
But i still just get the first Page's Data.
What's to do to get all the Data in the Grid?
Thanks for any advice
regards
Mike
You should set the PageSize for the DataPager, not for the GridView. From your code snippet it seems that you set it for the "grid".
Regards,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
thanks for your advice.
I setted the PageSitze Property of the Pager to 0 and ath the end of the Exporting i set it back to my original PageSize.
That works - so all Items getting Exported.
But i got a GridViewComboBoxColumn in my Grid. Which value is selected and i dont get the Value in my Export Excel Sheet.
Here is what it looks like:
<telerik:GridViewComboBoxColumn Width="Auto" Header="Mapping Organisation" Background="LightYellow" ItemsSource="{Binding Organisations}" DataMemberBinding="{Binding OrganisationItem, Mode=TwoWay}" DisplayMemberPath="OrganisationRegisterNoAndName" SelectedValueMemberPath="OrganisationRegisterNoAndName"> <telerik:GridViewComboBoxColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding OrganisationItem.OrganisationRegisterNoAndName}"/> </DataTemplate> </telerik:GridViewComboBoxColumn.CellTemplate> </telerik:GridViewComboBoxColumn>
Which property must be filled that the export is working also for the DropDownColumn?
If already tried it with this example in this post: http://www.telerik.com/community/forums/silverlight/gridview/export-doesn-t-capture-dropdown-column-values.aspx
but it didnt work for me - the value isnt exported.
thanks and regards
Mike
What do you have exported instead of the Selected value? Please note that you could subscribe for the ElementExporting event and manipulate the value to be exported if needed.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
You can as well check this help article showing how to export values placed inside a TextBlock. The article is for custom Header but the same approach can be applied for the defined CellTemplate.
Kind regards,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I am using Silverlight RadGridView with VirtualQueryableCollectionView for virtualized data loading while scrolling. I want to use Export features but as the current Export functionality will only export the data which is already loaded in the visible area of the grid, how should i proceed ?
If you want to be able to export all items you must ensure that they are loaded. Thus, I am afraid that you cannot achieve the desired behavior when using the Data Virtualization as it items are loaded when requested to be shown into view. I can suggest you to use a QueryableCollectionView or other collection that has all the items available.
All the best,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Excelente consejo
como puedo quitar el mensaje de advertencia al intentar abrir el documento de excel que se genero.
Warning message when opening the excel file:
The file you are trying to open, 'Filename.xls', is in a different format than specified by the file extension. Verify that the file is not
corrupted and is from a trusted source before opening this file. Do you want to open the file now?
RadGridView can export with ExportFormat.HTML and ExportFormat.ExcelML - in both cases not native for Excel 2010. In case of HTML export you will get such warning and this cannot be avoided, however if you export to ExcelML with XML extension you will not get it.
Please check this help article for a further information:
Warning message when opening the excel file.
You can also export data with RadSpreadProcessing. The model is completely independent from UI. You can check Export with RadSpreadProcessing as an example on how to do so.
Regards,
Didie
Telerik
Eh logrado exportar los datos con RadSpreadProcessing pero cuando se intenta exportar muchos registros el dialog.ShowDialog() == true manda una excepción "Los cuadros de diálogos deben ser iniciados por el usuario."