Automatic Column Sorting using LiNQ in C#
Posted on 2011-10-14
I am using a DataGridView to display data from two tables in my typed dataset.
I am creating the combined data using a LINQ query.
I am then assigning the datasource property of the DataGridView to the results of the LINQ Query.
At this point the data displays fine, however, the automatic sorting capabilities of the DataGridView columns are not available. The sorting returns when I use a standard datatable to display the data.
Code Sample Below:
myBindingSource.DataSource = myLINQQuery;
myDataGridView.DataSource = myBindingSource;
Thanks in advance for any suggestions.