C# Datagridview does not sort Checkbox column

前端 未结 2 1898
花落未央
花落未央 2021-02-20 01:01

When I bind a Linq-to-sql query to a datagridview (using a BindingSource in between), the columns are sortable by default. However, this does not seem to be the case for boolean

相关标签:
2条回答
  • 2021-02-20 01:42

    will this help?

    dgv1.Columns["Colname"].SortMode = DataGridViewColumnSortMode.Automatic;
    
    0 讨论(0)
  • 2021-02-20 01:57

    In VS2012 in the designer you can also set the SortMode.

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

    There's a drop-down for SortMode with a choice of NotSortable, Automatic, and Programmatic.

    It appears that the default for most columns is Automatic, but for checkboxes (boolean) columns the default is NotSortable.

    0 讨论(0)
提交回复
热议问题