RadComboBox for ASP.NET AJAX

RadControls for ASP.NET AJAX

By default, RadComboBox sorts items by their Text property. This article will show you how to implement custom sorting - the items will be sorted by their Value property.

For this purpose, we will use the IComparer interface which exposes a method that compares two objects.

Here are the two steps that you need to perform:

1. Create a class that implements IComparer for your custom sorting:

2. Call the overloaded SortItems or Items.Sort methods passing your IComparer as a parameter:

That's it. Now the combobox items will be sorted by their Values instead of Text.

See Also

Other Resources