Hi,
Im using Prometheus Rad grid . i try to group the grid by three fields.
first two fields are gridboundcolumn and i have given them within the groupby expression and another field is template field. I enabled the grouping for this template field as per help document.
Below is the Code,
<
telerik:RadGrid ID="RadGrid1" runat="server" Skin="Office2007" SkinsOverrideStyles="false"AutoGenerateColumns="false" BorderWidth="1px" BorderStyle="Solid" BorderColor="ActiveBorder">
<ClientSettings AllowGroupExpandCollapse="true">
</ClientSettings>
<MasterTableView GroupLoadMode ="Client" >
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField HeaderText=" " FieldName="Status" FormatString="{0:D}"
HeaderValueSeparator=" "></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="Status" ></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField HeaderText=" " FieldName="TSACode" FormatString="{0:D}"
HeaderValueSeparator=" "></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="TSACode" SortOrder="Ascending"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridBoundColumn Visible="false" HeaderText="Status" DataField="Status" UniqueName="Status"></telerik:GridBoundColumn>
<telerik:GridBoundColumn Visible="false" HeaderText="TSA" DataField="TSACode" UniqueName="TSACode"> </telerik:GridBoundColumn>
<telerik:GridBoundColumn Visible="false" HeaderText="PubId" DataField="PubId" UniqueName="PubId"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn Groupable="true" GroupByExpression="Title GROUP BY Title"
ItemStyle-Width="60%" HeaderText="Title" UniqueName="Title">
<ItemTemplate>
<asp:HyperLink ID="hypLnk" CssClass="HyperLink" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Title") %>'
ToolTip="Publication Info" Target="_blank">
</asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Country" DataField="CountryCode" UniqueName="CountryCode">
</telerik:GridBoundColumn>
</
Columns>
</MasterTableView>
</telerik:RadGrid>
Actual Result : Grid is grouped according to the two fields mentioned in the group by expression. group is missing for "Title" template column. Im getting Title and country as dataitemsExpected Result: Would like to group the grid according to status,TSACode,Title with hyperlink and country should be dataitem inside the groups...
Thanks,
Mey
14 Answers, 1 is accepted
In order to display the grid grouped by the template column, you will need to add a group by expression for it too. It could be like this:
<telerik:GridGroupByExpression> |
<SelectFields> |
<telerik:GridGroupByField FieldName="Title" > |
</telerik:GridGroupByField> |
</SelectFields> |
<GroupByFields> |
<telerik:GridGroupByField FieldName="Title" > |
</telerik:GridGroupByField> |
</GroupByFields> |
</telerik:GridGroupByExpression> |
Hope this helps.
Regards,
Ves
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

It seems a required expression is missing. Do you attempt to group by template columns which does not have group by expression defined?
Kind regards,
Konstantin Petkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

1st time the grouping works fine.
when i remove the grouping and try to drag agian it shows me
"Expression cannot be null or empty"
Any help appreciated.
Thanks
Satya
I suppose you already familiarized yourself with the discussion in this thread and the possible reason for this error to appear. If he problem is somewhere else in your case, please post your grid definition along with the relevant code-behind using the "Format code block" dialog from the forum editor. We will look into it and will get back to you with our findings.
Best regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

Thanks for your reply.
Kindly find my code block below.
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" AllowSorting="true" PageSize="10" AutoGenerateColumns="false" Skin="Outlook" |
AllowFilteringByColumn="true" ShowGroupPanel="True" GroupingEnabled="true"> |
<MasterTableView EditMode="EditForms" ShowFooter="True" AllowFilteringByColumn="true"> |
<GroupByExpressions> |
<telerik:GridGroupByExpression> |
<SelectFields> |
<telerik:GridGroupByField |
FieldName="datCreatedDate" |
FieldAlias="Date" |
HeaderText="Date"/> |
<telerik:GridGroupByField |
FieldName="vchGroupMarkingName" |
HeaderText="Group Marking" |
/> |
</SelectFields> |
<GroupByFields> |
<telerik:GridGroupByField |
FieldName="datCreatedDate" |
SortOrder="Descending" /> |
</GroupByFields> |
</telerik:GridGroupByExpression> |
</GroupByExpressions> |
<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> |
<Columns> |
<telerik:GridTemplateColumn HeaderText="Import/Export" HeaderStyle-HorizontalAlign="Center" ShowFilterIcon="false" > |
<ItemTemplate> |
<asp:CheckBox ID="chkImport" runat="server"></asp:CheckBox> |
<%--<cc1:MutuallyExclusiveCheckBoxExtender ID="meceImport" runat="server" Key="Import" TargetControlID="chkImport"> |
</cc1:MutuallyExclusiveCheckBoxExtender>--%> |
<asp:Label ID="ID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "intGroupMarkId") %>' visible="false"></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Group Marking" SortExpression="vchGroupMarkingName" HeaderStyle-HorizontalAlign="Center" ShowFilterIcon="true" |
AutoPostBackOnFilter="false" AllowFiltering="true"> |
<ItemTemplate> |
<asp:Label ID="lblGroup" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "vchGroupMarkingName") %>'></asp:Label> |
<asp:HiddenField ID="hdnGroupMarkId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "intGroupMarkId") %>' /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="BBS No" Visible="false"> |
<ItemTemplate> |
<asp:Label ID="lblBBS" runat="server"></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Parameter Set" SortExpression="tntParamSetNumber" HeaderStyle-HorizontalAlign="Center"> |
<ItemTemplate> |
<asp:Label ID="lblParameter" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "intParameteset") %>'></asp:Label> |
<asp:HiddenField ID="hdnParameter" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "tntParamSetNumber") %>' /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Date" SortExpression="datCreatedDate" HeaderStyle-HorizontalAlign="Center"> |
<ItemTemplate> |
<asp:Label ID="lblDate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "datCreatedDate") %>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
</MasterTableView> |
<ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" AllowDragToGroup="True" > |
</ClientSettings> |
<GroupingSettings ShowUnGroupButton="true" /> |
<HeaderStyle BackColor="Silver"> |
</HeaderStyle> |
</telerik:RadGrid> |
Thanks
Satya
You need to set GroupByExpression property value for your template columns as shown in the bottom section of this documentation article:
http://www.telerik.com/help/aspnet-ajax/grdgroupbydeclarativedefinition.html
Regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

I got through the issue.
Regards
Satya

I have run into the same issue but I don't see any of the reply below has the solution. Some of the links below talks about declarative grouping. I don't want to have any declarative grouping initially anyway. I think I pretty much have followed the instructions but still have gone wrong. Kindly have look at my code block. (simplified).
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"OrderID"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter OrderID column"
HeaderText
=
"OrderID"
SortExpression
=
"OrderID"
UniqueName
=
"OrderID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"ItemID"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter ItemID column"
HeaderText
=
"ItemID"
SortExpression
=
"ItemID"
UniqueName
=
"ItemID"
GroupByExpression
=
"ItemID Group By"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"ItemIDTextBox"
runat
=
"server"
Text='<%# Bind("ItemID") %>'></
asp:TextBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"ItemIDLabel"
runat
=
"server"
Text='<%# Eval("ItemID") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"OrderDate"
DataType
=
"System.DateTime"
FilterControlAltText
=
"Filter OrderDate column"
HeaderText
=
"OrderDate"
SortExpression
=
"OrderDate"
UniqueName
=
"OrderDate"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"ItemID"
>
</
telerik:GridGroupByField
>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"ItemID"
>
</
telerik:GridGroupByField
>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
I would like to add something to here when I get this working (hopefully) i have to further look into how it will work when I place a combo box controls inside the item template field. This field refers to a foreign table (lookup type content).
Any help will be much appreciated to evaluate Telerik controls.
Regards,
Siraj Zarook

I have worked it out with the help of this link below.
http://www.telerik.com/community/forums/aspnet-ajax/grid/quot-invalid-group-by-expression-group-by-clause-missing-quot-error-when-grouping-a-gridtemplatecolumn.aspx
Hope this will be useful for someone.
Regards,
SirajZ

I want to place a button after the GridGroupByField of RadGrid GroupByExpression. Iam using below code for binding the grid.Please see the attachement (grid image) for reference and provide the code for placing the button that i have marked in red color.
<telerik:RadGrid ID="rgPE" runat="server" OnItemDataBound="rgPE_ItemDataBound" OnDeleteCommand="rgPE_DeleteCommand"
AutoGenerateColumns="false" AllowSorting="true" OnNeedDataSource="rgPE_NeedDataSource">
<MasterTableView DataKeyNames="ItemTypeId">
<RowIndicatorColumn Visible="False">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="False">
<HeaderStyle Width="19px" />
</ExpandCollapseColumn>
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldAlias="ItemType" FieldName="ItemType" />
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="ItemType" />
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridBoundColumn UniqueName="ItemTypeId" DataField="ItemTypeId" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="ItemId" DataField="ItemId" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="ItemDescription" ItemStyle-Width="550px">
<ItemTemplate>
<asp:Label ID="lblItem" runat="server" Text='<%#Eval("ItemDescription") %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" UniqueName="Delete">
<HeaderStyle Width="20px" />
<ItemStyle HorizontalAlign="Center" />
</telerik:GridButtonColumn>
<telerik:GridTemplateColumn UniqueName="Revise">
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
<ItemTemplate>
<telerik:RadButton ID="rbtnR" runat="server" Width="50px" OnClick="rbtnR_Click" >
</telerik:RadButton>
<telerik:RadButton ID="rbtnE" runat="server" Width="50px" OnClick="rbtnE_Click" >
</telerik:RadButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="History">
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
<ItemTemplate>
<telerik:RadButton ID="rbtnIHIS" runat="server" OnClick="rbtnIHIS_Click">
</telerik:RadButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<NestedViewTemplate>
<telerik:RadGrid ID="rgUT" OnNeedDataSource="rgUT_NeedDataSource"
OnItemDataBound="rgUT_ItemDataBound" OnItemCreated="rgUT_ItemCreated"
runat="server" AutoGenerateColumns="false">
<MasterTableView DataKeyNames="ItemTypeId, ItemId, ItemConfigId">
<Columns>
<telerik:GridBoundColumn UniqueName="AmountType" DataField="AmountOrPercentageType" EmptyDataText="---">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn UniqueName="Value" DataField="Value" DataType="System.Decimal" EmptyDataText="---">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn UniqueName="StartDate" DataFormatString="{0:d}" DataField="StartDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="EndDate" DataFormatString="{0:d}" DataField="EndDate" EmptyDataText="---">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</NestedViewTemplate>
</MasterTableView>
</telerik:RadGrid>
Thanks & Regards,
Pavani P.

You can use GroupHeaderTemplate for showing the button. Here is the sample code.
aspx:
<
GroupHeaderTemplate
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"History"
/>
</
GroupHeaderTemplate
>
Thanks,
Shinu.

Iam getting the below error.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.Parser Error Message: Type 'Telerik.Web.UI.GridTableView' does not have a public property named 'GroupHeaderTemplate'.
Source Error:
|
Source File:****************************.aspx Line: 111
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

I was able to use the GroupHeaderTemplate property in the version 2012, 2, 607, 40. Make sure that you are using the latest version.
Thanks,
Shinu.