C # Datagridview not sorting Checkbox column

When I bind a Linq-to-sql query to a datagridview (using the BindingSource between them), the columns are sorted by default. However, this is not like Boolean types. For them, datagridview uses Checkbox columns, but when I click on the header, nothing happens. Any solution?

+5
source share
2 answers

In VS2012 in the designer, you can also install SortMode.

Right-click on the DataGridView and go to "Edit Columns".

A drop-down list appears for SortMode with a choice of NotSortable, Automatic and Programmatic.

, "", checkboxes (boolean) NotSortable.

+12

?

dgv1.Columns["Colname"].SortMode = DataGridViewColumnSortMode.Automatic;
+3

All Articles