DropDownList items sort order by descending DropDownList is an asp.net list web server control that allow us to select one item at a time from a drop-down-list. by default dropdownlist items are not sorted. to provide better user experience, web developer wants to create a sorted dropdownlist. the following asp.net c# example code demonstrate us how can we render a dropdownlist server control which items are descending sorted. DropDownList server control have no built in property or method to sort its items descending or ascending order. we need to apply few techniques to display a sorted dropdownlist programmatically. At first we create a generic list which data type is ListItem. now we populate the generic list from dropdownlist items collection. next we sort the list by descending order using Linq OrderByDescending() extension method. finally we clear the dropdownlist items, and repopulate the dropdownlist with the sorted generic list. now we can d...
Android, .NET C#, Flutter, and Many More Programming tutorials.