Datagrid Combobox question

  • Thread starter Thread starter Mel Parkes
  • Start date Start date
M

Mel Parkes

I have a winforms datagrid that has several columns. Three
of the columns are displaying combo boxes. When the user
selects a value in the 1st combo, I would like to have the
data displaying in the other combos filter based upon the
selected value. Does anyone have suggestions for how to
re-apply a data source for a combo box in a datagrid after
the columnstyles have already been added?
 
Hello Mel,
You asked a good question, filtering the values in combo box by the other
values in the data grid is really a good idea.
First, let me repeat my understanding on your issue, you have a data
grid, and have written your own combo box column style, what you want is
when user changes certain one of them, the rest of the combo boxes should
only have the values related to that new value, am I right?
Ok, I think you have two ways to implement this feature; you may use
either of them.
The first solution is derive a class from your ComboBoxColumnStyle and
override the method SetColumnValueAtRow, you can get the rest column styles
via it's property
DataGridTableStyle.GridColumnStyles, then you may do as you wish. Use this
type in the column which you want to AWARE other columns.
The second solution is similar; you can derive a class from
ComboBoxColumnStyle, and override the Edit method. Then you can use this
type in columns which you want to be AWARED.
As you can see, the first solution is suitable for the case that one
value can determine several other values, and the second solution is more
suitable for the case that one value should be determined by several values.

I hope these solutions can help you resolve your problem, if you have any
updates on this issue, please let me know, thanks!


Kind regards,

Ying-Shen Yu [MSFT]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Content-Class: urn:content-classes:message
| From: "Mel Parkes" <[email protected]>
| Sender: "Mel Parkes" <[email protected]>
| Subject: Datagrid Combobox question
| Date: Wed, 13 Aug 2003 17:23:04 -0700
| Lines: 9
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNh+jo+0GY4OwkpTyWhajiODNYdhw==
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:50230
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| I have a winforms datagrid that has several columns. Three
| of the columns are displaying combo boxes. When the user
| selects a value in the 1st combo, I would like to have the
| data displaying in the other combos filter based upon the
| selected value. Does anyone have suggestions for how to
| re-apply a data source for a combo box in a datagrid after
| the columnstyles have already been added?
|
|
|
 
-----Original Message-----
I have a winforms datagrid that has several columns. Three
of the columns are displaying combo boxes. When the user
selects a value in the 1st combo, I would like to have the
data displaying in the other combos filter based upon the
selected value. Does anyone have suggestions for how to
re-apply a data source for a combo box in a datagrid after
the columnstyles have already been added?


.
 
Back
Top