Hello everybody! I suppose this is my first post on StackOverFlow.com :-)
I had this problem for a while. To keep things simple, suppose we have two database tables with the names โbooksโ and โcategoriesโ with the following schema:
books (id, title, catId)
Categories (id, catName)
Obviously, the "catId" field in the "books" table is a foreign key and indicates the category to which the book belongs.
I created the necessary LinQ to Sql classes and created the required bindingSource object. What I'm trying to do is show all the books in a DataGridView. I want it to have a column named "Category", which is of type DataGridViewComboBoxColumn, containing all existing categories, and for each book the category to which the particular book belongs is displayed. The user can reassign the category of the book by selecting another category in the combo box.
I managed to do exactly what I want with the ComboBox, and it works the way I want. But when it comes to DataGridView, I just can't figure it out.
Any help would be greatly appreciated. I spent days to understand something, but so far no luck: - (
source share