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

[Solved] Sorting on a date field breaks my SQL sorting

1 Answer 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DogEars
Top achievements
Rank 2
DogEars asked on 03 Mar 2008, 09:21 PM
I've got a specific requirement to sort my dates a certain way...basically by year, then month, then day. It looks like this:

order by YEAR(DueOnDock) ASC, MONTH(DueOnDock) ASC, DAY(DueOnDock) ASC

Now there may be a better way to do that sort, but if so I don't know how.

So, while my initial sort looks like it should on the loading of the RadGrid, when I click on the column header to sort it breaks and sorts by just the leading month, as my data is in MM/DD/YYYY format.

And everything needs to be grouped by year, then sorted by day and month. Maybe it's just my SQL that's making this thing bug out.

Please advise if I'm doing it wrong or there is a workaround.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Mar 2008, 11:21 AM
Hello DogEars,

You can implement custom sorting in your case. More info can be found here:
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/GeneralFeatures/Sorting/DefaultCS.aspx

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
DogEars
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Share this question
or