Combobox in datagrid?

J

John Doe

Now i know how to manually add a combobox to a datagrid,
but how would i handle the recordset below?

ID | FirstName | LastName | Job
--------------------------------
1 |Joe | Smith | janitor
1 |Joe | Smith | cashier
2 |Bob | Anderson | cook

I want to bind the above datatable to a datagrid so that
Job field will be a combobox of the appropriate list of
jobs. So for Joe Smith, it will have janitor and cashier,
for Bob, it will only have cook. So the datagrid would
only display the two row (one for each person). Is there
a way to do this without having to look through the rows
and manually adding to the combobox? Some kind of group by
functionality?
 
C

Cor Ligthert

Hi John,

I assume you mean a dataset and not a recordset.
There is no standard combobox for the datagrid, they all are inheritted
ones, so the answer is difficult to give with code.

However the answer is most probably Yes most comboboxes for datagrid work
the same as a normal combobox so you can add in your code the items you
want.

And when you want it from a datatable than you have to make that datatable.
When you want the selectedvalue, than you need a columntype
datagridcombobox.

I hope this helps,

Cor
..
 

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

Top