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

Dealing with "" or Null in Sort Expressions

1 Answer 44 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Lonnie
Top achievements
Rank 1
Lonnie asked on 19 Oct 2011, 08:46 PM
I have a sort expression that works on multiple columns in the listview, but anything that is blank in the datasource comes up first in the sort. For instance I have a name and a business, but sometimes there isn't a business associated with the name. I am sorting in the order of Business, Last Name, then First Name. The blank businesses come up first because "" or null comes before it in sort order. Is there any way to work around this.

Thanks,
Lonnie

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 21 Oct 2011, 11:31 AM
Hi Lonnie,

As you noted yourself, this is the expected behavior of sorting and it is not within the capabilities of RadListView to change it. This is so because the RadListView is simply a bound control displaying the available data, it does not manipulate it internally.
So, your option is to handle the sorting manually and return a collection of only the non-null records or with your custom order applied. For more information you could take a look at this help article:
Custom Sorting

Greetings,
Tsvetina
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
ListView
Asked by
Lonnie
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or