Is there a way how to sort a DataGridViewComboBoxColumn by its DisplayMember instead of the ValueMem

  • Thread starter Thread starter Amit
  • Start date Start date
A

Amit

Hi All,

Is there a way how to sort a DataGridViewComboBoxColumn by its
DisplayMember instead of the ValueMember

Thanks,
Amit
 
Hi All,

Is there a way how to sort a DataGridViewComboBoxColumn by its
DisplayMember instead of the ValueMember

Thanks,
Amit

You have a couple of options
- Sort the data directly from your data source
- Bind the combo box to a bindingsource, rather than directly to a dataset.
You can then sort the bindingsource on the column you want. If you're on
..NET 1.1, bind the combo box to a dataview
 
Actually the issue is when we click on column header of datagridviewcomboboxcolumn in that case it sorts the column by the underlying value i.e ID. That means sort is being done on the basis of Value member.
I would like to know if there is any way out to sort DataGridViewComboboxColumn on the basis of it displyed value i.e formatted values.
The limitation is that the datatable to which grid is bind does not contain the column on which i wish to sort.

regards
RS
 
Actually the issue is when we click on column header of datagridviewcomboboxcolumn in that case it sorts the column by the underlying value i.e ID. That means sort is being done on the basis of Value member.
I would like to know if there is any way out to sort DataGridViewComboboxColumn on the basis of it displyed value i.e formatted values.
The limitation is that the datatable to which grid is bind does not contain the column on which i wish to sort.

regards
RS
 
Actually the issue is when we click on column header of datagridviewcomboboxcolumn in that case it sorts the column by the underlying value i.e ID. That means sort is being done on the basis of Value member.
I would like to know if there is any way out to sort DataGridViewComboboxColumn on the basis of it displyed value i.e formatted values.
The limitation is that the datatable to which grid is bind does not contain the column on which i wish to sort.

regards
RS

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
Back
Top