I am getting a list of objects such as this:
Category Name Sequence
Category B Something 1
Category B Something 2
Category C Something 3
Category A Something 4
Category A Something 5
When I do a Group By with the Category I get this:
Category: Category A
Category A Something 4
Category A Something 5
Category: Category B
Category B Something 1
Category B Something 2
Category: Category C
Category C Something 3
My markup looks like this:
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField HeaderText="Classification" FieldName="Classification.Name" ></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="Classification.Name" SortOrder="None"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
Where Classification is my Category.
This is sorting the classifications in alphabetical order. I cannot get this to not happen this way. I want them to sort by the sequence that I pass it in. I have tried referenceing the sequence, this doesn't work. Please tell me how to get it to group by Category, but do not alphabetize them and do not show the sequence in the header as this will be a hidden column. Thanks.
Ultimately, I want it to end up like this:
Category: Category B
Category B Something 1
Category B Something 2
Category: Category C
Category C Something 3
Category: Category A
Category A Something 4
Category A Something 5
Thanks,
Mike
14 Answers, 1 is accepted

Category Name Sequence
Category B Something 1
Category B Something 1
Category C Something 2
Category A Something 3
Category A Something 3
I then do this:
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField HeaderText="Classification" FieldName="Classification.Name" SortOrder="None"></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField HeaderText="Sequence" FieldName="Classification.Sequence" SortOrder="Ascending"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
Notice in my GroupByFields, I am now grouping by Sequence instead of Classification. Which now gives me this:
Category: Category B
Category B Something 1
Category B Something 1
Category: Category C
Category C Something 2
Category: Category A
Category A Something 3
Category A Something 3

I have a Radgrid and I am using GridGroupByExpression to enable my items to appear in one group and like this i have a sequence of Group with some items in each of it.
I am facing a similar issue, whenever I add some Group name in any order it gets sorted automatically alphabetically. I am not able to retain the order in which I enter my group name.
Is there any property by which we can set the Grid Group By Expression sorting to none and achieve the results that I want.
Group a:
Canada
Germany
Group: c
India
USA
Group d:
Finland
In the above example I have Grouped the Items under a,c,d and when I enter the Group names in any order they appear in alphabetical order.
Kindly help me in this regard.
Thanks in advance
Prashant
You cannot set sort order to none. Please refer to the following help article:
http://www.telerik.com/help/aspnet-ajax/telerik.web.ui-telerik.web.ui.gridgroupbyfield_properties.html
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.



It seems you can not turn off the default sorting when grouping in the grid but may be you can try the following suggestion:
Find out the column name based on which the grid is currently grouped by, in the GroupsChanging event of the grid, create your custom SortExpresion programmatically and then add that sort expression to the mastertable's SortExpressions collection. You can find more explanation on this in the following forum link:
Sorting a Grouped Grid
Hope this gets you started..
Princy.

I am facing a similar issue, whenever I add some Group name in any order it gets sorted automatically alphabetically.
My data:
Seq EmpID EmpName CompanyName DepartmentName
1 emp0001 Emp A Company C Department C1
2 emp0002 Emp B Company C Department C1
3 emp0003 Emp C Company B Department B1
4 emp0004 Emp D Company A Department A1
Then I do a GroupBy with the CompanyName, I get this:
Seq EmpID EmpName DepartmentName
CompanyName: Company A
4 emp0004 Emp D Department A1
CompanyName: Company B
3 emp0003 Emp C Department B1
CompanyName: Company C
1 emp0001 Emp A Department C1
2 emp0002 Emp B Department C1
RadGrid sorted automatically alphabetically by ComapnyName. I dont want the sorting to be done.
I want to display the data as it is in collection which i am binding to grid like this:
Seq EmpID EmpName DepartmentName
CompanyName: Company C
1 emp0001 Emp A Department C1
2 emp0002 Emp B Department C1
CompanyName: Company B
3 emp0003 Emp C Department B1
CompanyName: Company A
4 emp0004 Emp D Department A1
Please help me to solve it! It is very urgent for me!
Thanks!


Thanks!



Below code is displaying Company name and ordered by Seq:
<MasterTableView GroupLoadMode="Client" TableLayout="Fixed" DataKeyNames="DbrewId, NewsTitle">
<GroupHeaderItemStyle Font-Bold="true" />
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField HeaderText=" " HeaderValueSeparator="" FieldName="NewsGroupName" />
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="Seq"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridTemplateColumn>

Protected
Sub
mygrid_GroupsChanging(
ByVal
sender
As
Object
,
ByVal
e
As
GridGroupsChangingEventArgs) _
Handles
mygrid.GroupsChanging
If
e.Action = GridGroupsChangingAction.Group
Then
Dim
sExpression
As
GridGroupByExpression = e.Expression
sExpression.GroupByFields(0).SortOrder = GridSortOrder.Descending
End
If
End
Sub

I fixed this issue by using "FieldName" property. Please find the below code:
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField HeaderText=" " HeaderValueSeparator=" " FieldName="NewsGroupName" />
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="Seq" />
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>