RadControls version |
Q1 2007 |
.NET version |
2.0 |
Visual Studio version |
2005 |
programming language |
C#, VB |
browser support |
all browsers supported by RadControls |
PROJECT DESCRIPTION This project shows how to sort the child items of data-bound RadMenu, RadPanelbar, RadTabstrip and RadTreeview in the DataBound event. The items of a RadCombobox are sorted on button click.
The key idea in this approach is that I store the child items in a collection of the respective type (RadMenuItemCollection, RadPanelItemCollection...). Then I clear the parent item(owner) of its child items collection and add the items again based on some rule. In this project I sort the items by text, but you can easily adjust the approach to sort them by any other property including custom attributes or you can filter the items or just apply any custom rule.
This is a really flexible method which can suit almost any scenario related to reorganizing a collection of items. The controls do not have to be
data-bound but in this case you will have to use the
Page Load event. Detailed comments are inserted in the code. I hope you find this project useful and easy to use.