S
sklett
I'm changing from a DataGrid to a DataGridView and have run across a
problem. The items that are bound to the DataGrid have an int Property that
represents a primary key of a lookup table in my database. For example:
table JobTypes
1 | Manager
2 | Controller
3 | Supervisor
table Employee
2 | JobTypeID
(other fields)
I want to display the JobType name in the column of the datagridview, then
when a user clicks to edit the type I want to display a ComboBox that lists
all the records from the JobType table. When the user selects an item, I
want to store it's ID in the bound Employee object in the JobTypeID field.
I hope that makes sense. The part that I'm not clear on is how to bind the
combobox column to a separate datasource and have the ComboBox column select
the item that matches the value of JobTypeID.
Has anyone done this? Seems like it would be a common task but I haven't
any examples showing how to accomplish this.
Thanks for reading,
Steve
problem. The items that are bound to the DataGrid have an int Property that
represents a primary key of a lookup table in my database. For example:
table JobTypes
1 | Manager
2 | Controller
3 | Supervisor
table Employee
2 | JobTypeID
(other fields)
I want to display the JobType name in the column of the datagridview, then
when a user clicks to edit the type I want to display a ComboBox that lists
all the records from the JobType table. When the user selects an item, I
want to store it's ID in the bound Employee object in the JobTypeID field.
I hope that makes sense. The part that I'm not clear on is how to bind the
combobox column to a separate datasource and have the ComboBox column select
the item that matches the value of JobTypeID.
Has anyone done this? Seems like it would be a common task but I haven't
any examples showing how to accomplish this.
Thanks for reading,
Steve