datagridview not sorting on combobox columns


I have a datagridview with textbox columns and combo box columns. For some reason, the datagridview is not sorting on the combobox columns.
Column headerclick to sort is not working for comboboxcolumns.
What might be the prolem?

Who is Participating?
lofConnect With a Mentor Commented:
check properties of the DataGridViewColumn.
there must be a mistake in the code as normally DataGridView supports soring ComboBox columns
RameshSConnect With a Mentor Commented:
The combobox will sort automatically if you set the DataGridViewColumn.SortMode Property to DataGridViewColumnSortMode.Automatic. The datagridview combobox column sorts on value of the column it is bound too. That is, If you bind a datasource such as DataTable and set the DisplayMember and Value member proerpties, the sorting will happen on ValueMember. Check the SortMode property.

Also please check the following memebers.

Sorting a DataGridView by DataGridViewComboxBoxColumn
DataGridView: Sort a combobox column
Sorting Bound DataGridView by ComboBoxColumn displayMember
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.