470,572 Members | 2,574 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,572 developers. It's quick & easy.

complex grid with comboboxes

I have a datagrid which has (amongst other stuff) 2 comboboxes columns.
So far so good. The trick is that when I select a value in my first
column, it must updates the items of the combobox in the second column
for the same row.

In the first column, comboboxes contain names of tables. In the second
column, comboboxes contain names of the fields in the table selected in
the first column.

Tricky uh ?

Does anybody have an idea ?

Nov 21 '05 #1
6 1105
Maybe I haven't been clear enough
My problem is that I don't know how to update the datasource of the
comboboxes in the second column regarding what has been selected in the
comboboxes in the first column of the grid (for the corresponding row)

Nov 21 '05 #2

Catch the CheckedChanged event of the CheckBoxes in the first column.
Get the state of the checkbox (as well all additional data like the
text and tag property if you use them) which raised the event, get the
current selected row in the DataGrid. Then update the datasource using
the row number which you got and the field of the second column with
checkboxes. This is if I understood you question correctly.


1. The user checked a checkbox in the first column.
2. The CheckedChanged event is raised.
3. Get which checkbox raised the event and get the information (like
the name of the tables you mentioned and the checkstate)
4. Get the current selected row.
5. Update the second column with checkboxes.



Nov 21 '05 #3
I'm not using checkboxes... I'm using combobox. But that might be the
same principle, isn't it ?

Nov 21 '05 #4
Actually it might sounds weird, but in fact the only solution in my
opinion is to modify the datasource of the second column according to
what I've been selected in the first one. The problem ist that it might
(and it's not actually) not be the same values at each row in the first
column. Therefore the datasource should be different for every single
rows of the second column. Is that doable ???

Nov 21 '05 #5

It seems I gone crazy! When I red your message, I was seeing checkboxes
not comboboxes, haha! So this is the reason for not understanding your
question before :)
If I understood you correctly you want to select table in the first
column and the fill the second column with the field names of the table
selected in the first one! Is that you are wanting to do?


1. User chooses a table from the combobox.
2. SelectedIndexChanged event is raised.
3. Get the table name from the combo box.
4. Get field names from the table.
5. Fill the second column's combobox with the field names!
6. The user made his/her choice with the second combobox.
7. SelectedIndexChanged event is raised.
8. Get the field name which the user selected.
9. Put into the datasource! Voila!

As I see maybe you do not know how to get which combobox from the first
column and second column is clicked? Right?

Sam, we shall find a solution to your problem, hope my mind is working
now :)


Nov 21 '05 #6
Thanks for this reply.
I have solved my problem yesterday, pretty much the way you've
Hope your brain is getting better, lol ;)


Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jesper Denmark | last post: by
1 post views Thread by fiaolle | last post: by
4 posts views Thread by R.A.F. | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.