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

A

Amit

Hi All,

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

Thanks,
Amit
 
R

Rad [Visual C# MVP]

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
 
R

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
 
R

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
 
R

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top