I need to display data in a GridDataBoundGrid. All the data will be sourced from a dataset, for e.g. Dataset1. However I need to display one of the grid coulmns in the middle as a drop down, which needs to display data from a different dataset eg dataset2.
I have been succesfull in displaying data from a single source, but not multiple sources depending on the cell type. Any help would be greatly appreciated.
ADAdministrator Syncfusion Team November 7, 2002 06:04 AM
Does your main table contain a column that you want to replace with values from this second table based on the 'key value' found in the column of the main table? For example, in the Orders table from Northwind, there is a CustomerID column. But in the display of this Orders table, you do not want to see the CustomerID, but instead want to see the actual CustomerName. To get this information, you would need to load the Customers table...
If you are trying to do this type of Foreign-Key COmboBox, it is straight-forward. You load your two tables, setting the main table as the datasource in the grid. Then you have to add a combobox for the column you want to swap out by using a GridBoundColumn. In this GridBoundColumn, you set the StyleInfo.DataSource to your foreign table, and you set the StyleInfo.DisplayMember to the column you want to see, and the StyleInfo.ValueMember to the column that matches the value from the main table.
You can do all this from the designer. The GDBGwithCombos sample has foreign-key combos in it, and it was done enirely from the designer. In the 1.5 release (soon), the User's Guide has code snippets showing how you might do this from code.
If you really want to slip a new column into your grid from another table, then you would have to use techniques similar to the GDBGMultiHeader sample that shows how to add unbound columns. In this case, you would get the unbound values from your second table.
DMdmbravoMay 3, 2004 04:27 AM
Hello. How doing the same but with TextBox instead of ComboBox ?. Although puts in DisplayMember the field of the foreign table to me continues placing foreign key. Thanks
ADAdministrator Syncfusion Team May 3, 2004 06:29 AM
Instead of using a TextBox, you can still use a ComboBox, but set the StyleInfo.ShowButtons = Hide so the dropdown button never appears.