Hello,
I have a DataGridView with a combobox column in it, showing the possible prices, and I would like to only display the prices relevant to the particular row.
In more details, let's say that I have a class method which returns me a dataset with 2 tables populated (feeded by a stored procedure running on a SQL Server 2005 database).
The first table contains the Order Details rows and the second table the prices valid for each of the products.
Basically, my DataTables from the dataset looks like this.
OrderDetails
ProductType | ProductID | Qty | SelectedPrice |
DairyProduct | Milk | 5 | 5.50 |
Fruit | Orange | 7 | 6.90 |
and so on...
On my prices table from the dataset, I have all the prices valid for all products for the order date.
Prices
ProductType | ProductID | Price |
DairyProduct | Milk | 5.50 |
DairyProduct | Milk | 6.90 |
DairyProduct | Milk | 7.90 |
Fruits | Orange | 6.90 |
Fruits | Orange | 4.50 |
and so on...
I'm binding my OrderDetails table to a DataGridView, which the user will need to modify.
I would like the price column of the DataGridView to display the prices from my second table of the dataset.
I've managed to do that, and I now have a combobox for each row, but the ComboBox is displaying all the prices from my prices table, and what I would like to have is only it display the prices valid for that particular product. For example, if the user clicks the DataGridView on a Milk row, it should only display the prices for the milk and not all of them.
I'm not sure how to achieve that. Any pointers or examples?
Thanks a lot in advance!
I'm developing on VS 2008, in C# and WinForms.