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

Sorting Order

3 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 26 Mar 2012, 02:36 PM
I have implemented sorting on my RadGrid and wanted to know if I could change the sort order (asc/desc) when the user clicks the column to be sorted? I know if the user clicks the column again it will alternate between the two types of sorting (asc/desc) or no sort based on this article , but what I want to control, is the order of the sort when the column is first clicked. Currently on the first click the column sorts ascending, but I want it to sort descending when it is click for the first time. Thanks in advance

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 26 Mar 2012, 02:53 PM
Hi Kyle,

You can skip this default sort behavior and provide your own custom sort order for a column by setting the AllowCustomSorting property of the corresponding table view. With custom sorting enabled, RadGrid displays the sorting icons but does not actually sort the data. Instead, you perform the custom sorting inside the SortCommand event handler. More information is available in the article below:
http://www.telerik.com/help/aspnet-ajax/grid-apply-custom-sort-criteria.html

Kind regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andreas
Top achievements
Rank 1
answered on 27 Jun 2012, 02:19 PM
Hi,

We also needed this.
For example when sorting on date columns it is very common that the new items should be on top on first sort.
When using custom sort and reversing everything, doesn't the sort images display the wrong direction?

Would be really nice with a simple property on the column like this:
<telerik:GridBoundColumn DataField="UpdateDATE" DefaultSortOrder="Descending"  DataFormatString="{0:g}" />

Thanks
Caesar
0
Pavlina
Telerik team
answered on 29 Jun 2012, 05:08 PM
Hello Caesar,

Thank you for your suggestion about the new property. We will have it in mind along with the other requests we receive about the requested functionality.

Please do not hesitate to contact us if other questions or problems arise.

Kind regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Kyle
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Andreas
Top achievements
Rank 1
Share this question
or