Hi, I am trying to export Excel from RadGrid control, but its giving page error. Unable to debug also. Immediately its expires the page. I have used <GroupByExpressions> option in grid. Is this not allowing us to export excel ?
Because I didn't find any demos or example in from your end on export excel with <GroupByExpressions> option.
In the code behind C# code -
buttonexport click event i have written below code
if you mentioned below line before exporting method. Getting page error -
below is the apx code -
Can you please help out, how to export excel when we have <GroupByExpressions> option on aspx page.
Let me know if you need any more information.
for the reference I have added snapshots
Because I didn't find any demos or example in from your end on export excel with <GroupByExpressions> option.
In the code behind C# code -
buttonexport click event i have written below code
Grid.ExportSettings.IgnorePaging = true;Grid.ExportSettings.ExportOnlyData = true;Grid.ExportSettings.OpenInNewWindow = true;Grid.ExportSettings.FileName = "filename"; Grid.MasterTableView.ExportToExcel();
if you mentioned below line before exporting method. Getting page error -
Grid.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;below is the apx code -
<telerik:RadGrid ShowGroupPanel ="false" AutoGenerateColumns ="false" ID ="Grid" AllowFilteringByColumn ="False" AllowSorting ="False" ShowFooter ="True" runat ="server" GridLines ="Both" AllowPaging ="false" EnableLinqExpressions ="false" CssClass ="RadGridCustomClass" OnPreRender ="Grid_PreRender" OnExcelMLExportRowCreated="Grid_ExcelMLExportRowCreated" OnGridExporting ="Grid_GridExporting" OnExcelMLExportStylesCreated="Grid_ExcelMLExportStylesCreated" OnItemDataBound ="Grid_ItemDataBound"> <PagerStyle Mode="NextPrevAndNumeric" /> <MasterTableView ShowGroupFooter ="true" HeaderStyle-Font-Bold ="true" HeaderStyle-ForeColor ="#333333" AllowMultiColumnSorting ="false"> <Columns> <telerik:GridBoundColumn DataField ="SubCategory" ItemStyle-HorizontalAlign ="Center" UniqueName ="REP013_FuellingCategoryHeaderText" FooterStyle-HorizontalAlign ="Center" FooterStyle-Font-Bold ="true" HeaderStyle-HorizontalAlign ="Center" > </telerik:GridBoundColumn> <telerik:GridBoundColumn Aggregate ="Sum" DataField ="Total_Fuel_Litres" DataType ="System.Int32" UniqueName ="REP013_TotalFuelHeaderText" DataFormatString ="{0:###,###.##}" ItemStyle-HorizontalAlign ="Center" FooterStyle-HorizontalAlign ="Center" FooterStyle-Font-Bold ="true" HeaderStyle-HorizontalAlign ="Center" FooterText ="<%$ Resources:MyGlobals, REP013_TotalFuelFooterText%>"> </telerik:GridBoundColumn> <telerik:GridBoundColumn Aggregate ="Avg" DataField ="Bio_Content" DataFormatString ="{0:0.0%}" UniqueName ="REP013_BioContentHeaderText" ItemStyle-HorizontalAlign ="Center" FooterStyle-HorizontalAlign ="Center" FooterStyle-Font-Bold ="true" HeaderStyle-HorizontalAlign ="Center" > </telerik:GridBoundColumn> <telerik:GridBoundColumn Aggregate ="Sum" DataField ="Bio_Diesel_Litres" DataFormatString ="{0:###,###}" UniqueName ="REP013_BioDieselHeaderText" ItemStyle-HorizontalAlign ="Center" FooterStyle-HorizontalAlign ="Center" FooterStyle-Font-Bold ="true" HeaderStyle-HorizontalAlign ="Center" FooterText ="<%$ Resources:MyGlobals, REP013_BioDieselFooterText%>"> </telerik:GridBoundColumn> <telerik:GridBoundColumn Aggregate ="Sum" DataField ="Standard_Diesel_Litres" DataFormatString ="{0:###,###}" UniqueName ="REP013_StandardDieselHeaderText" ItemStyle-HorizontalAlign ="Center" FooterStyle-HorizontalAlign ="Center" FooterStyle-Font-Bold ="true" HeaderStyle-HorizontalAlign ="Center" FooterText ="<%$ Resources:MyGlobals, REP013_StandardDieselFooterText%>"> </telerik:GridBoundColumn> <telerik:GridBoundColumn Aggregate ="Sum" DataField ="CO2_Tonnes" DataFormatString ="{0:###,##0.0}" UniqueName ="REP013_CO2QuantityHeaderText" ItemStyle-HorizontalAlign ="Center" FooterStyle-HorizontalAlign ="Center" FooterStyle-Font-Bold ="true" HeaderStyle-HorizontalAlign ="Center" FooterText ="<%$ Resources:MyGlobals, REP013_CO2QuantityFooterText%>"> </telerik:GridBoundColumn> </Columns> <GroupByExpressions> <telerik:GridGroupByExpression> <SelectFields> <telerik:GridGroupByField FieldName="Category" /> </SelectFields> <GroupByFields> <telerik:GridGroupByField FieldName="Category" SortOrder="Ascending" /> </GroupByFields> </telerik:GridGroupByExpression> </GroupByExpressions> </MasterTableView> <ClientSettings AllowDragToGroup ="false" /> <GroupingSettings ShowUnGroupButton ="false" /> </telerik:RadGrid>Can you please help out, how to export excel when we have <GroupByExpressions> option on aspx page.
Let me know if you need any more information.
for the reference I have added snapshots