Home | Index | Dotnet4all Snippets | Submit resources
About | Mail us 
Combobox in datagrid? (Monday, January 30, 2006)



Found the following interesting discussion in the Newsgroups:

Combobox in datagrid?
by: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?


 Reply:
by: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



Posted by Xander Zelders



0 Comments:

Post a Comment

<< Home

 
Previous Posts
    - How to change the Color of a Toolbar?
    - How to pass Objects as type System.Object?
    - How to create a Username/Login Page?
    - Suggestions to increase the performance of searchi...
    - Where did my Dataset Go?
    - Password Filter DLL
    - An application framework for VB.NET
    - 'System.Net.WebException' - Strange Error
    - Dataset Tablenames <- SQLHelper
    - Add handlers to textboxes in a datagrid



Disclaimer & Terms of Use | DotNet4All.Com concept & © 2004 - 2007 by Zelders² - Holland