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

DataBoundGrid ComboBox Question

I have a grid bound to a dataset table which contains a "status" column with integer numbers from 0 to 5. I would like to use a combobox celltype to display this information and map each of the numbers to a textual description. eg. 0 = Lemon 1 = Apple 2 = Bananna 3 = Peach 4 = Orange 5 = Pear So when the column loads the dropdown is selected at the correct index showing the text description of the underlying numeric value. Then the user can drop the menu down to select a different fruit whereupon the underlying dataset value is changed to its numeric mapping. Thanks Mark

3 Replies

AD Administrator Syncfusion Team June 1, 2004 12:35 PM UTC

You can create a second datatable with 2 columns, one holding 0 - 5 and the other holding lemom through pear. Then set the GridBoundColumn.StyleInfo.DataSource to this DataTable. Also set the DisplayMember and ValueMember for this same combobox column in your grid. Here is a little sample. WindowsApplication11_6533.zip

AD Administrator Syncfusion Team June 1, 2004 01:06 PM UTC

Thanks, Just as an aside is there a way to achive the same result without creating a second datatable? Mark

AD Administrator Syncfusion Team June 1, 2004 03:44 PM UTC

You do have to create some type of datasource for your combobox with two public properties in it. It does not have to be a DataTable, but it does have to have the two properties. So, you could use an ArrayList of objects with two public properties, or some list that implemented ITypedList, or ???

Live Chat Icon For mobile
Up arrow icon