Say you have the following tables representing customers and their accounts...
CustomerId CustomerName--------------------------------------------------------------1 ABC Company2. XYZ Company
AccountId CustomerId AccountName----------------------------------------------------------------------------------------------1 1 Account 0012 1 Account 0023 2 Account 0034 2 Account 004 5 2 Account 005
So, as you can see customer #2 has three possible accounts and customer #1 has two. I have a grid with two dropdown columns. When the account field is entered I can catch the event and filter my data source to exclude accounts that don't belong to the current customer. Unfortunately, since I just filtered out records that are referenced by other rows in the grid they revert to showing the primary key rather than the name. That behavior makes perfect sense, the question is what is the best practice when you have a situation like this? Are there any built-in events or methods that I could use to dynamically adjust the dropdown values on a row-by-row basis without affecting other rows?
The way to handle something like this is - don't use the same ValueList for the entire column. You should create a ValueList for each possible list and assign the ValueList to the cells that apply. You would set the ValueList property on the cell inside the InitializeRow event of the grid.