Reputation:
hi i have a datagridview in a form... users by clicking the column name can sort the row data in that column either in ascending or descending orders... how is it possible to disable it? so that the data in rows of every columns stays in that order in which they were on the start of the form... thanks!
Upvotes: 2
Views: 1440
Reputation: 47783
use a repeater and custom pager control. Forget GridView, DataGrid, etc.
Upvotes: 0
Reputation: 273774
Like the other answers state, there is no global property on the DataGrid, you will have to set on each column individually.
for(int x = 0; x < dataGridView1.Columns/Count; x++)
dataGridView1.Columns[x].SortMode = DataGridViewColumnSortMode.NotSortable;
Upvotes: 2
Reputation: 53603
Programmatically:
YourDataColumn.SortMode = DataGridViewColumnSortMode.NotSortable;
In the designer:
Upvotes: 7