Requirements |
|
Telerik Product and Version |
RadGrid 2016.3.914 |
Supported Browsers and Platforms |
IE 11 |
Components/Widgets used (JS frameworks, etc.) |
PROJECT DESCRIPTION
I'm working on Exporting a Grouped RadGrid, but I'm only getting the top level rows. I've followed the examples I found here but must be doing something else wrong.
My grid is defined as follows:
<
MasterTableView
>
<
SortExpressions
>
<
telerik:GridSortExpression
FieldName
=
"FULLNAME"
SortOrder
=
"Ascending"
/>
</
SortExpressions
>
<
NoRecordsTemplate
>
<
asp:Label
ID
=
"Label1"
Text
=
"No Records Found"
runat
=
"server"
/>
</
NoRecordsTemplate
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"FULLNAME"
ShowFilterIcon
=
"false"
DataField
=
"FULLNAME"
SortExpression
=
"FULLNAME"
HeaderText
=
"Name"
CurrentFilterFunction
=
"Contains"
AutoPostBackOnFilter
=
"true"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"lbUserName"
runat
=
"server"
CommandArgument='<%# Eval("USERID") %>'
Text='<%# Eval("FULLNAME") %>' OnClick="lbUserName_Click" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"COMPANY"
HeaderText
=
"CO"
DataField
=
"COMPANY"
ShowFilterIcon
=
"false"
CurrentFilterFunction
=
"Contains"
AutoPostBackOnFilter
=
"true"
DataType
=
"System.String"
/>
<
telerik:GridBoundColumn
UniqueName
=
"PLATOON"
HeaderText
=
"PLT"
DataField
=
"PLATOON"
ShowFilterIcon
=
"false"
CurrentFilterFunction
=
"Contains"
AutoPostBackOnFilter
=
"true"
DataType
=
"System.String"
/>
<
telerik:GridBoundColumn
UniqueName
=
"SQUADRON"
HeaderText
=
"SQD"
DataField
=
"SQUADRON"
ShowFilterIcon
=
"false"
CurrentFilterFunction
=
"Contains"
AutoPostBackOnFilter
=
"true"
DataType
=
"System.String"
/>
<
telerik:GridBoundColumn
UniqueName
=
"TOTALCOUNT"
HeaderText
=
"Soldiers"
DataField
=
"TOTALCOUNT"
ShowFilterIcon
=
"false"
CurrentFilterFunction
=
"EqualTo"
AutoPostBackOnFilter
=
"true"
DataType
=
"System.Int32"
Aggregate
=
"Sum"
/>
</
Columns
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"FULLNAME"
HeaderText
=
" "
/>
</
GroupByFields
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"FULLNAME"
HeaderText
=
" "
HeaderValueSeparator
=
" "
/>
<
telerik:GridGroupByField
FieldName
=
"TOTALCOUNT"
HeaderText
=
" "
HeaderValueSeparator
=
"Soldiers: "
Aggregate
=
"Sum"
/>
</
SelectFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
</
MasterTableView
>
</
telerik:RadGrid
>
My code in the ItemCommand is:
grid.MasterTableView.HierarchyDefaultExpanded = true;
grid.MasterTableView.GroupsDefaultExpanded = true;
grid.MasterTableView.ExportToExcel();
I'm having the same problem with a grid with DetialTables. the code for that is as follows:
<
MasterTableView
DataKeyNames
=
"COMPANYID"
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"PLATOONID"
Name
=
"PLATOONVIEW"
runat
=
"server"
AllowNaturalSort
=
"false"
AllowMultiColumnSorting
=
"false"
ShowHeader
=
"false"
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"SQUADRONID"
Name
=
"SQUADRONVIEW"
runat
=
"server"
AllowNaturalSort
=
"false"
AllowMultiColumnSorting
=
"false"
ShowHeader
=
"false"
>
<
SortExpressions
>
<
telerik:GridSortExpression
FieldName
=
"SQUADRON"
SortOrder
=
"Ascending"
/>
</
SortExpressions
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"SQUADRON"
AllowFiltering
=
"false"
DataField
=
"SQUADRON"
SortExpression
=
"SQUADRON"
CurrentFilterFunction
=
"Contains"
AutoPostBackOnFilter
=
"true"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"lbSquadName"
runat
=
"server"
CommandName
=
"VIEWSQUADRON"
CommandArgument='<%# Eval("SQUADRONNAME") %>' Text='<%# Eval("SQUADRON") %>' />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"COMPANYNAME"
DataField
=
"COMPANYNAME"
Display
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"PLATOON"
DataField
=
"PLATOON"
Display
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"TOTALSQUADCOUNT"
HeaderText
=
"Soldiers"
DataField
=
"TOTALSQUADCOUNT"
ShowFilterIcon
=
"false"
AllowFiltering
=
"false"
DataType
=
"System.Int32"
/>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
SortExpressions
>
<
telerik:GridSortExpression
FieldName
=
"PLATOON"
SortOrder
=
"Ascending"
/>
</
SortExpressions
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"PLATOON"
AllowFiltering
=
"false"
DataField
=
"PLATOON"
SortExpression
=
"PLATOON"
HeaderText
=
"PLT Name"
CurrentFilterFunction
=
"Contains"
AutoPostBackOnFilter
=
"true"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"lbPlatoonName"
runat
=
"server"
CommandName
=
"VIEWPLATOON"
CommandArgument='<%# Eval("PLATOONNAME") %>' Text='<%# Eval("PLATOON") %>'/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"COMPANYNAME"
DataField
=
"COMPANYNAME"
Display
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"PLATOONID"
DataField
=
"PLATOONID"
ShowFilterIcon
=
"false"
AllowFiltering
=
"false"
Display
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"TOTALPLATOONCOUNT"
HeaderText
=
"Soldiers"
DataField
=
"TOTALPLATOONCOUNT"
ShowFilterIcon
=
"false"
AllowFiltering
=
"false"
DataType
=
"System.Int32"
/>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
CommandItemSettings
ShowExportToPdfButton
=
"false"
ShowAddNewRecordButton
=
"false"
ShowRefreshButton
=
"false"
/>
<
SortExpressions
>
<
telerik:GridSortExpression
FieldName
=
"COMPANYNAME"
SortOrder
=
"Ascending"
/>
</
SortExpressions
>
<
NoRecordsTemplate
>
<
asp:Label
ID
=
"Label1"
Text
=
"No Records Found"
runat
=
"server"
/>
</
NoRecordsTemplate
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"COMPANYNAME"
AllowFiltering
=
"false"
DataField
=
"COMPANYNAME"
SortExpression
=
"COMPANYNAME"
HeaderText
=
"CO Name"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"lbCompanyName"
runat
=
"server"
CommandName
=
"VIEWCOMPANY"
CommandArgument='<%# Eval("COMPANYNAME") %>' Text='<%# Eval("COMPANYNAME") %>' />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"COMPANYID"
DataField
=
"COMPANYID"
ShowFilterIcon
=
"false"
AllowFiltering
=
"false"
Display
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"TOTALCOMPANYCOUNT"
HeaderText
=
"Soldiers"
DataField
=
"TOTALCOMPANYCOUNT"
ShowFilterIcon
=
"false"
AllowFiltering
=
"false"
DataType
=
"System.Int32"
/>
</
Columns
>
</
MasterTableView
>
Any help would be appreciated.