I'm trying to export a radgridview to Excel. When I was using regular paging, everything was working fine but since I switched to virtual paging, I can only export the current page to excel instead of the entire grid's contents. I've added the following code to the ItemCommand handler:
case RadGrid.ExportToExcelCommandName:
{
rgResult.PageSize = rgResult.MasterTableView.VirtualItemCount;
rgResult.ExportSettings.ExportOnlyData = true;
rgResult.ExportSettings.IgnorePaging = true;
rgResult.ExportSettings.OpenInNewWindow = true;
rgResult.MasterTableView.ExportToExcel();
}
break;
This causes an "System.ArgumentOutOfRangeException" exception when trying to set the page size equal to the grid's virtual item count. Probably because the VirtualItemCount is equal to 0.
Thanks!
case RadGrid.ExportToExcelCommandName:
{
rgResult.PageSize = rgResult.MasterTableView.VirtualItemCount;
rgResult.ExportSettings.ExportOnlyData = true;
rgResult.ExportSettings.IgnorePaging = true;
rgResult.ExportSettings.OpenInNewWindow = true;
rgResult.MasterTableView.ExportToExcel();
}
break;
This causes an "System.ArgumentOutOfRangeException" exception when trying to set the page size equal to the grid's virtual item count. Probably because the VirtualItemCount is equal to 0.
Thanks!