Hi all,
How do I sort the columns in a winforms datagrid control into alphabetical order?
Thanks
Hi all,
How do I sort the columns in a winforms datagrid control into alphabetical order?
Thanks
Have you tried binding the DataGrid to a DataTable object (instead of a view) and turning setting the "AllowSorting" property to true on the DataGrid? I believe the grid will then automatically sort the table source for you.
If not, you can always catch the event when a column header is clicked and rebuild a DataView to bind to the DataGrid.
This MSDN article should guide you along the way.
If you provide more information perhaps we can provide actual code for your specific problem.
Scott, can you clarify - you want to sort the columns in alphabetical order, or allow sorting on columns?