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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing Cells Values

Thread ID:





3217 Mar 8,2003 11:14 PM UTC Mar 9,2003 08:08 AM UTC WinForms 1
Tags: GridControl
Jose Luis Melo
Asked On March 8, 2003 11:14 PM UTC

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.

Administrator [Syncfusion]
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon