I'm using a DataBoundGrid, and I need to change the values that comes from a specific column of the database to other values in the grid.
Database Column values=0,1,2
In the Grid I need to 'translate' 0 for "Married", 1 for "Single", and so on....
How to do this ?
ADAdministrator Syncfusion Team March 9, 2003 03:08 AM
You can do this using a foreignkey combobox. The idea is to have a special datasource that holds objects that has two properties, the value from the data (the ValueMember), and the value that you want to see (the DisplayMember). This datasource could be an ArrayList or a DataTable or ???.
For this column in your grid, make the style's celltype a ComboBox, and then set the style's DisplayMember to be the propertyname that you want to see, and make the style's ValueMember the propertyname that is the actual value stored in your data. Also, set the style's DataSource the the special datasource your created.
Attached is a sample that shows how you might do this. It shows two grids displaying the same datatable. But the first grid has a foreign key combo in column 2. So, in the first grid you see the DisplayValue there, but in the second grid which does not use a foreign combo, you see the raw data from the table.
Also, if you really don't want the column to appear as comboboxes, you can hide the button so it looks like a text column.