Hi Telerik's team,
I am trying build a radgrid where data should to be grouped in two levels. How can I do this using GroupHeaderTemplate ?
Below is my radgrid. It is grouped by code Primary Key from data. But I need to group then inside a parent group setting header group like a template.
Yet, I just grouped by ID. How can I group by ParentGroupId too?
I am trying build a radgrid where data should to be grouped in two levels. How can I do this using GroupHeaderTemplate ?
Below is my radgrid. It is grouped by code Primary Key from data. But I need to group then inside a parent group setting header group like a template.
Yet, I just grouped by ID. How can I group by ParentGroupId too?
<
telerik:RadGrid
ID
=
"radgrid"
runat
=
"server"
AutoGenerateColumns
=
"false"
Skin
=
"Silk"
Width
=
"90%"
Visible
=
"false"
AllowMultiRowSelection
=
"true"
AllowSorting
=
"true"
AllowPaging
=
"true"
ShowStatusBar
=
"true"
EnableLinqExpressions
=
"false"
OnItemDataBound
=
"radgrid_ItemDataBound"
OnDataBound
=
"radgrid_DataBound"
CellSpacing
=
"0"
GridLines
=
"None"
OnPageIndexChanged
=
"radgrid_PageIndexChanged"
>
<
ClientSettings
AllowDragToGroup
=
"true"
EnableRowHoverStyle
=
"true"
AllowColumnsReorder
=
"true"
Selecting-AllowRowSelect
=
"true"
ClientEvents-OnRowDeselected
=
"UnCheckGroup"
ReorderColumnsOnClient
=
"true"
ColumnsReorderMethod
=
"Reorder"
>
<
Animation
AllowColumnReorderAnimation
=
"true"
AllowColumnRevertAnimation
=
"true"
></
Animation
>
</
ClientSettings
>
<
MasterTableView
DataSourceID
=
"ods"
DataKeyNames
=
"ID"
GroupLoadMode
=
"Client"
GroupsDefaultExpanded
=
"false"
GroupHeaderItemStyle-HorizontalAlign
=
"Left"
>
<
GroupHeaderTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"Label1"
ForeColor
=
"#2F4F4F"
Text
=
"Id: "
></
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"Label3"
Text='<%# (((GridGroupHeaderItem)Container).AggregatesValues["ID"]) %>'></
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"Label2"
ForeColor
=
"#2F4F4F"
Text
=
"Date: "
></
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"Label6"
Text='<%# (((GridGroupHeaderItem)Container).AggregatesValues["Date"]) %>'></
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"Label7"
ForeColor
=
"#2F4F4F"
Text
=
"Price: $"
></
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"Label8"
Text='<%# (((GridGroupHeaderItem)Container).AggregatesValues["Price"]) %>'></
asp:Label
>
</
GroupHeaderTemplate
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ProductName"
UniqueName
=
"ProductName"
HeaderText
=
"Product"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Amount"
UniqueName
=
"Amount"
HeaderText
=
"Amount"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
</
telerik:GridBoundColumn
>
</
Columns
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"ParentGroupID"
/>
</
GroupByFields
>
</
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"ID"
/>
</
SelectFields
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"Date"
/>
</
SelectFields
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"Price"
FormatString
=
"{0:C}"
/>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"ID"
/>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
</
MasterTableView>
</
telerik:RadGrid>
<
asp:ObjectDataSource
ID
=
"ods"
runat
=
"server"
SelectMethod
=
"ListItems"
TypeName
=
"...my namespace ..."
></
asp:ObjectDataSource
>