Export Data in a Group to Excel
Sometimes you may need to export just the data in a group in a grouped RadGridView. This is possible by using the context menu:
1. Create RadContextMenu and get the right-clicked group header row by using the MouseDown event and the GetGridGroupHeaderRowElement method. After determining the clicked group row, you can get its child rows. Then simply show the context menu:
2. Since the export to excel methods do not support exporting only specified records, you can work-around this if you temporarily hide the unnecessary rows and use ExportToExcelML class with the DonNotExport for HiddenRowOption properties.
3. In the click event of the context menu item, mark the rows in the RadGridView.Rows collection that match the rows of the child collection by setting their IsVisible property to true, and all the rest to false. Then simply export RadGridView with HiddenRowOption set to HiddenOption.DoNotExport:
4. If you need to get the text from the GroupRowHeader, use the following snippet: