How can I disable sort in DataGridView
? I need to disable the header DataGridView
sorting.
foreach (DataGridViewColumn column in dataGridView.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; }
Use LINQ:
Datagridview1.Columns.Cast<DataGridViewColumn>().ToList().ForEach(f => f.SortMode = DataGridViewColumnSortMode.NotSortable);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With