تسجيل الدخول

مشاهدة النسخة كاملة : dataGridView filtering with IList.



C# Programming
05-15-2010, 04:23 AM
I'm stuck on a previous problem that I posted a week or so ago (Please let me know if it is considered rude to post a new thread in this case)

I have a dataGridView that is bound to table1 in dataset1. I have changed the column type for column1 to a comboBox and have populated the collection with instances. Let's say 1, 2, and 3.

column2 is also a comboBox, but its instances need to be driven by column1. For '1' in column1, column2 would allow 11,12,13 and for '2' in column1, column2 would allow 21,22,23.

One suggestion was to create another dataTable in dataset1, and bind column2 to the new datatable using another bindingSource and then filter.

I went ahead and created another dataTable and edited the second column in the dataGridView to have the DataSource as bindingSource2 and the DisplayMember as column1 (the first column in dataTable2) (while this may not make sense at first glance, my objective was to manually populate data in dataTable2, column1 and then make sure the comboBox in column2 in dataTable1 would populate with dataTable2 values). But, this did not work.

Would it be easier here to create (3) ILists (IList1, IList2, IList3) each of which contain i1, i2, i3 for each list and then populate the comboBox in column2 of dataTable1 based upon the selection made in column1?

Do I need to look at the second dataTable option a bit more closely?

Thanks.