473,698 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi All,

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

Thanks,
Amit

Mar 16 '07 #1
4 5844
On 16 Mar 2007 03:22:06 -0700, Amit wrote:
Hi All,

Is there a way how to sort a DataGridViewCom boBoxColumn 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 datagridviewcom boboxcolumn 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 DataGridViewCom boboxColumn 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 datagridviewcom boboxcolumn 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 DataGridViewCom boboxColumn 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 datagridviewcom boboxcolumn 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 DataGridViewCom boboxColumn 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
3458
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 the second query just returns 1 value to each combobox. So, in other words, for each textbox, the next result of the second query puts 1 value in the corresponding combobox. Here is my code... What the heck am I doing wrong???? cmd =...
0
1226
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 sorts the grid on the ValueMember (which is a non-significant ID number) and not on the DisplayMember (which is a significant text). This is for the user very confusing, because he sees a list that is not
0
2959
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 and woefully misguided. public class SomeClass { private string name;
0
2210
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). All classes that implement this interface are shown in a drop down in a DataGridViewComboBoxColumn named Validator. By choosing the class to validate this specific data in the drop downbox IValidator<T>.Validate is called and returns true/false....
0
1038
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
2003
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 gvProfile.Columns) { DataColumn ndc = new DataColumn();
1
4659
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 `Memberdetails` Valuemember : MembershipNo I would like to sort the combo box by surname/MemberDetails but it currently only sorts by membershipNo. I have tried the sorted = true value which does sort by surname but does not sort the Valuemember:...
1
5321
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 from the database (this also has worked). But, now I want to be able to have the user select one of the items in that combo box and fire off an event to select more data from the database based on what the user selected in the combo box. Well,...
1
2716
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 city_id corresponding to that city_name. Code: //City ComboBox comboboxCity.DataPropertyName = "city_name"; comboboxCity.HeaderText = "City"; comboboxCity.DataSource = city_table;
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8610
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.