//遍历每一列,禁用排序
for (int i = 0; i < dgvDemo.Columns.Count; i++)
dgvDemo.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;