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
close icon

Changing Cells Values

Hi, 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. Example: 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 ? Thanks.

1 Reply

AD Administrator Syncfusion Team March 9, 2003 08:08 AM UTC

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.

Loader.
Live Chat Icon For mobile
Up arrow icon