data grids with combo boxes


G

Geraldine Hobley

Hi,
I need to add a combo box to a data grid, however the
catch is that the datasource for each combo box is
different in each row.

I have added a combo box for a customer column like so
'
we need to have a combo box in the customer column
Dim ComboCustCol As New DataGridComboBoxColumn
ComboCustCol.MappingName
= "Customerindex" 'must be from the grid table...
ComboCustCol.HeaderText = "Customer"
ComboCustCol.Width = 120
'DataView dv = new DataView(myDataSet.Tables
["customerList"], "", "customerID",
DataViewRowState.CurrentRows);
ComboCustCol.ColumnComboBox.DataSource =
dsCurrDataset.Tables!
Customerlist.DefaultView ' .DefaultView 'dv;
ComboCustCol.ColumnComboBox.DisplayMember
= "Companyname"
ComboCustCol.ColumnComboBox.ValueMember
= "customerkey"


This all works but I need another combo box next to it
that takes the value from this combo box and uses it to
select the contacts for this combo box. (i.e. the combo
box on each row has a different datasource. ).

Any ideas or examples of this would be greatly appreciated.

Geraldine.
 
Ad

Advertisements

R

Rajesh Patel

you did not put which column you are binding another combobox. here you say,

" This all works but I need another combo box next to it
that takes the value from this combo box and uses it to
select the contacts for this combo box. (i.e. the combo
box on each row has a different datasource. ).
"

here, I understand you would like to put combobox in a next column, not in a
next row.

Could you please explain more, what do you want?

Rajesh Patel
 
Ad

Advertisements

G

Geraldine Hobley

Hi Rajesh,
Yes I would like to put the combo box in the next
column, not the next row.

so I have say column 2 (customer index) and in column 3 I
would like a combo box for contacts, but the datasource
for this combox box is dependant on the value in column 2
i.e. column 2 contains customerindex and the datasource
for the combo in column 3 is "select * from contacts where
customerindex = " & customerindex (from column 2). I hope
that this is clearer

many thanx

geraldine
-----Original Message-----
you did not put which column you are binding another combobox. here you say,

" This all works but I need another combo box next to it
that takes the value from this combo box and uses it to
select the contacts for this combo box. (i.e. the combo
box on each row has a different datasource. ).
"

here, I understand you would like to put combobox in a next column, not in a
next row.

Could you please explain more, what do you want?

Rajesh Patel


Geraldine Hobley said:
Hi,
I need to add a combo box to a data grid, however the
catch is that the datasource for each combo box is
different in each row.

I have added a combo box for a customer column like so
'
we need to have a combo box in the customer column
Dim ComboCustCol As New DataGridComboBoxColumn
ComboCustCol.MappingName
= "Customerindex" 'must be from the grid table...
ComboCustCol.HeaderText = "Customer"
ComboCustCol.Width = 120
'DataView dv = new DataView(myDataSet.Tables
["customerList"], "", "customerID",
DataViewRowState.CurrentRows);
ComboCustCol.ColumnComboBox.DataSource =
dsCurrDataset.Tables!
Customerlist.DefaultView ' .DefaultView 'dv;
ComboCustCol.ColumnComboBox.DisplayMember
= "Companyname"
ComboCustCol.ColumnComboBox.ValueMember
= "customerkey"


This all works but I need another combo box next to it
that takes the value from this combo box and uses it to
select the contacts for this combo box. (i.e. the combo
box on each row has a different datasource. ).

Any ideas or examples of this would be greatly appreciated.

Geraldine.

.
 

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

Similar Threads

Combo in grid 2
check box in data grid 2
Question about Infragistics Grid and combo box 0
Data Grid 1
Data Grid 2
Access to the internal property grid combo box control 1
Data grid headers 0
Data Grid - Style 1

Top