Asp.net: How to sort a dropdown list with duplicates?
2 answers
Instead of adding items directly to the dropdown, I would suggest adding them to the data structure you are binding to. If the elements in this structure are implemented IComparable
, then you can define a comparison method to apply the sort before Dropdown is actually bound to the data source.
+2
source to share