2 problems here;
1. Header row (column titles) are not exported to Excel when I have more than 10 items in a export. I thought it might be related to the page size so I changed my page size to encompass 12 rows and still no header row.
2. I am unable to get the entire dataset to export to excel. I can only get the 1st page. See code snipit
EDIT:
After further investigation the lack of the export of the header row does not appear to be a row count issue. It appears that only the first DetailGrid of the first row of the MasterDetailGrid exports the column headers. I have tried this on all of my implementations and the behavior is consistent across them
1. Header row (column titles) are not exported to Excel when I have more than 10 items in a export. I thought it might be related to the page size so I changed my page size to encompass 12 rows and still no header row.
2. I am unable to get the entire dataset to export to excel. I can only get the 1st page. See code snipit
ActiveBatchesRadGrid_ItemCommand
calls the method ConfigureExport
in the base class so all exports function the sameprivate
void
ActiveBatchesRadGrid_ItemCommand(
object
source, GridCommandEventArgs e)
{
switch
(e.CommandName)
{
case
RadGrid.InitInsertCommandName:
_gridTableView = e.Item.OwnerTableView;
break
;
case
RadGrid.ExportToExcelCommandName:
ExpandAllDetailTableRecords(source, ExpandedStates,
false
);
ConfigureExport(source, e);
break
;
}
}
protected
static
void
ConfigureExport(
object
source, GridCommandEventArgs e)
{
e.Item.OwnerTableView.ExpandCollapseColumn.Visible =
false
;
e.Item.OwnerTableView.GetColumn(
"PolicyEditRecord"
).Visible =
false
;
e.Item.OwnerTableView.GetColumn(
"DeleteTransaction"
).Visible =
false
;
e.Item.OwnerTableView.GetColumn(
"ManualAdjustmentBatchID"
).Visible =
false
;
e.Item.OwnerTableView.GetColumn(
"ManualAdjustmentID"
).Visible =
false
;
((RadGrid)source).ExportSettings.ExportOnlyData =
true
;
//((RadGrid)source).PageSize = ((RadGrid)source).MasterTableView.VirtualItemCount;
((RadGrid)source).ExportSettings.IgnorePaging =
true
;
((RadGrid)source).ExportSettings.OpenInNewWindow =
false
;
((RadGrid)source).MasterTableView.HierarchyDefaultExpanded =
false
;
((RadGrid)source).MasterTableView.ExportToExcel();
}
VirtualItemCount
is commented out because it throws an "System.ArgumentOutOfRangeException: Specified argument was out of the range of
valid values." error. I have not tried it yet but I think it may be due to the export being conducted on the DetailGrid and not the MasterGrid. Any comments on that would be appreciated too.EDIT:
After further investigation the lack of the export of the header row does not appear to be a row count issue. It appears that only the first DetailGrid of the first row of the MasterDetailGrid exports the column headers. I have tried this on all of my implementations and the behavior is consistent across them