473,378 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

Hi All,

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

Thanks,
Amit

Mar 16 '07 #1
4 5823
On 16 Mar 2007 03:22:06 -0700, Amit wrote:
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
--
Bits.Bytes
http://bytes.thinkersroom.com
Mar 16 '07 #2
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
---
Posted via DotNetSlackers.com
Apr 11 '07 #3
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
---
Posted via DotNetSlackers.com
Apr 11 '07 #4
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
Apr 11 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shawn | last post by:
I am trying to use a DataGridView to display one column of textboxes with a single value from a query and then next to it have a combobox that displays results from another query. What happens is...
0
by: GregMandel | last post by:
Hi, I have a problem with the DatagridView of VB 2005. In a DatagridView I have a databound DataGridViewComboBoxColumn. My problem is now, that if I click in the header of this column, VB...
0
by: Simon Tamman | last post by:
How do other people get around having to define the ValueMember in a DataGridViewComboBoxColumn when binding to a list of business objects? I'm currently doing the following, and it feels wrong...
0
by: Ken | last post by:
Hi I have a little application that does datavalidation. It supports dynamically loaded plugins (you drop a dll with a class implementing IValidator<Tin the same dir as the main application)....
0
by: Amit | last post by:
Hi All, Is there a way how to sort a DataGridViewComboBoxColumn by its DisplayMember instead of the ValueMember Thanks, Amit
0
by: =?ISO-8859-2?B?UmFmYbMgR2llemdhs2E=?= | last post by:
I have: protected void InitControls() { gvProfile.AutoGenerateColumns = false; DataTable dtProfile = new DataTable("KFS"); // dodajemy kolumny foreach(DataGridViewColumn dc in...
1
by: Kingkev83 | last post by:
I have a problem, i use a combo box to display members details in the following format display member: (concatinated field) Surname &' '& Forename &' '& MembershipNo & - & DateofBirth as...
1
by: =?Utf-8?B?RWQgQ29oZW4=?= | last post by:
I have tried to use the DataGridComboBoxColumn object with limited success. What I want to do is to create one new unbound column to be a combo box (so far, this has worked), populate it with items...
1
by: PIERREWHY | last post by:
I have a datagridview containing a datagridviewcombobox. The combobox has a dataset containing city_name and city_id. When I select a new city_name in the combobox I would like to return the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.