How to sort a Listview Items in Descending order?

 Posted by vishalneeraj-24503 on 12/25/2013 | Category: C# Interview questions | Views: 1457 | Points: 40
Answer:

With the help of Sorting property of ListView we can sort any listview items.There is SortOrder Enum of a Sorting property,which has Ascending,Descending and None values.By which we can sort our list-view in any order.

For Example:-

lst_view_fruit_names.Items.Add("Apple");


lst_view_fruit_names.Items.Add("Orange");

lst_view_fruit_names.Items.Add("Banana");


lst_view_fruit_names.Sorting = SortOrder.Descending;


Then,list-view has Orange,Banana and Apple.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response