We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drop down combo for foreign key in grouping grid

I have a dataset with two tables. Say Customers and Orders. I display the Orders table in the grid, but want a drop down combo for the CustomerID column. Also, I want to display and sort by Customer name from the Customer table. What is the best way to do this. Can it be done both by code and the designer? Thanks.

4 Replies

AD Administrator Syncfusion Team April 6, 2005 05:44 AM

Take a look at the \Syncfusion\Essential Suite\3.0.1.0\Windows\Grid.Windows\Samples\Grouping\ForeignKeyReference. It does things from code, but I think you should be able to set the same properties via the designer as well.


AD Administrator Syncfusion Team April 6, 2005 09:25 AM

I followed the example you suggested, but have one problem: The grid shows all columns from the foreign key table in the main grid. Following the example, I added the line customersRd.ChildTableDescriptor.VisibleColumns.Add("CompanyName"); This restricted the columns shown in the drop down grid, but still all columns from the foreign key table was shown in the main grid. How can I restrict the columns shown in the main grid?


AD Administrator Syncfusion Team April 6, 2005 09:33 AM

Did you try explicitly removing them from the parent''s VisibleColumns (customers.TableDescriptor.VisibleColumns.Remove).


AD Administrator Syncfusion Team April 7, 2005 03:04 AM

Removing the columns explicitly from the main table worked fine. Now I can have only one column from the Customer table in the main grid and many columns in the drop down grid. Perfect!

Loader.
Live Chat Icon For mobile
Up arrow icon