Grid problem

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
0
0

When I click a column header for sorting application  and then aplication has a error.

 

Test project link :

http://www.huzursoft.com/TestGridProject.rar

  • You must to post comments
0
0

Thank you for the sample.

The issue in the sample is that .ToList() converts the table to a list and .NET lists don’t support column sorting. They have only one Sort() method which either uses the default comparer or requires a custom comparer.

In you sample you can simply assign the Table<customer> to the data source:

             dataGridView1.DataSource = veri.customers; // instead of dataGridView1.DataSource = veri.customers.ToList();

In alternative, if you want to sort the list you need to implement a SortableBindingList<T>: http://stackoverflow.com/questions/23661195/datagridview-using-sortablebindinglist

HTH

Best,

Luca

 

 

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 1, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json