Click here to Skip to main content
15,072,134 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have "BindingList<items> lstItems" bounded to a datagrid. How can I implement the sort option for any column.
Posted

There are multiple solutions of a SortableBindingList, derived from BindingList, on the web.
[Even Microsoft has one.]

When binding this, you get sortable columns in your DataGridView
   
You can use the Sort method of the List, like this:

List<object> list = myBindingList.ToList();
list.Sort();
myBindingList = new BindingList<object>(list);

Its easy and seens to be fast.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900