This is a migrated thread and some comments may be shown as answers.

Group By Sort (using different field)

4 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Levi
Top achievements
Rank 1
Levi asked on 20 Oct 2008, 05:27 PM
I have a date field for which I want to allow the user to group on, but I want to actually sort the grouping by another field.

For instance... the field being grouped on is formatted like so "10/12/2007", etc. It is a regular date field. But when the user groups on this field, my group by expression actually uses a different field, which is a text representation as found in Outlook ("Today, Yesterday, Last Week, etc.). The problem is when the user sorts the grouping, i need to use a different field to sort on since my text representation would not end up in the correct order (it would be alphabetical instead). I need to instead override this and use the original data field to sort the groups on. Is this possible?

Thanks!
Levi

4 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 22 Oct 2008, 12:30 PM
Hello Levi,

You can handle the SortCommand event of the grid and there implement your logic. Find more information on custom grid sorting in the following resources:

http://www.telerik.com/help/aspnet-ajax/grdapplycustomsortcriteria.html
http://www.telerik.com/help/aspnet-ajax/grdsortingexpressions.html

Let us know if you need further directions/help.

Kind regards,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Amjad
Top achievements
Rank 1
answered on 02 Feb 2012, 12:28 PM
Hello Lana;

the provided links are broken can you please give us simillar links

Thanks
0
Jayesh Goyani
Top achievements
Rank 2
answered on 02 Feb 2012, 01:43 PM
Hello Amjad,

Please look in Below link.
http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/expressions/defaultcs.aspx


or

Please check below code snippet.
<telerik:GridBoundColumn DataField="Name" SortExpression="Name"
                              GroupByExpression="ID Group By ID"


Thanks,
Jayesh Goyani
0
Princy
Top achievements
Rank 2
answered on 02 Feb 2012, 02:31 PM
Hello Amjad,

Take a look into the following links.
Sort Expressions.
Applying Custom Sort Criteria.

Thanks,
Princy.
Tags
Grid
Asked by
Levi
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Amjad
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or