I am using Telerik RadGrid (v4.0.30319) and I have a dataset with about 171 columns and approximately 63K records. When I export these records to excel 2010, I get an error "Exception of type 'System.OutOfMemoryException' was thrown." How can I go about exporting such a large file to excel?
My code is :
My code is :
if (e.Button.Text == "Export"){ if (SessionVars.ReportID > 0) { Report rpt = new Report(SessionVars.ReportID); foreach (GridColumn c in GridReportData.MasterTableView.Columns) c.HeaderStyle.Width = Unit.Empty; GridReportData.ExportSettings.HideStructureColumns = true; GridReportData.ExportSettings.FileName = Gridrpt.Report_Name; try { GridReportData.MasterTableView.ExportToExcel(); } catch (System.OutOfMemoryException ex) { RadWindowManager.RadAlert("Report failed to export.",null, null, "Export Error", "ErrorAlert"); } RadAjaxManager1.EnableAJAX = true; }}