data grids with combo boxes

  • Thread starter Thread starter Geraldine Hobley
  • Start date Start date
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.
 
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
 
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.


.
 
Back
Top