3 Answers, 1 is accepted
0
Accepted
Hi Franco,
I hope this helps. Best wishes,
Peter
the Telerik team
Thank you for writing.
Sorting in RadListControl is controlled only via the SortStyle property. It supports ascending sort style, descending sort style and no sort style. Setting sorting through code looks like this:
radListControl1.SortStyle = Telerik.WinControls.Enumerations.SortStyle.Ascending;
So, if you want to use custom comparer method for sorting operation you should use this approach:
List<RadListDataItem> sortList =
new
List<RadListDataItem>(radListControl1.Items);
sortList.Sort(MyOwnComparer);
radListControl1.Items.Clear();
radListControl1.Items.AddRange(sortList);
I hope this helps. Best wishes,
Peter
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
0
Eric
Top achievements
Rank 1
answered on 05 Jul 2012, 04:49 PM
Hi!!
I'm following the suggestion here, and I created a custom IComparer to order the list as numbers. But I'm having some problems creating a list from the RadListControl.List Method. It always return for me a list of RadListDataItem, but all of them are returned as Nothing. I'm using VB language. Here is the piece of code:
How can I make it create a proper list of RadListDataItem? Could it be a bug at the RadListControl component?
Thanks in advanced!
Eric
I'm following the suggestion here, and I created a custom IComparer to order the list as numbers. But I'm having some problems creating a list from the RadListControl.List Method. It always return for me a list of RadListDataItem, but all of them are returned as Nothing. I'm using VB language. Here is the piece of code:
'my comparer:
Dim
myComparer
As
IComparer(Of RadListDataItem) =
New
RadListDataItemNumericComparer()
'here it creates the list with the number of items I have, but all items are Nothing (the same as null in C#):
Dim
sortList
As
New
List(Of RadListDataItem)(myRadList.Items)
'so, it fails here, because I have a list of Nothing objects:
sortList.Sort(myComparer)
myRadList.Items.Clear()
myRadList.Items.AddRange(sortList)
How can I make it create a proper list of RadListDataItem? Could it be a bug at the RadListControl component?
Thanks in advanced!
Eric
0
Hello Eric,
Thank you for writing.
I was not able to reproduce the described issue. Having in mind the numerous scenarios possible with this control, it will be best if you send us a sample project that reproduces the issue. This will allow us to investigate it and provide you with proper support.
I am looking forward to your reply.
All the best,
Peter
the Telerik team
Thank you for writing.
I was not able to reproduce the described issue. Having in mind the numerous scenarios possible with this control, it will be best if you send us a sample project that reproduces the issue. This will allow us to investigate it and provide you with proper support.
I am looking forward to your reply.
All the best,
Peter
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>