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

DataBoundGrid ComboBox Question

Thread ID:

Created:

Updated:

Platform:

Replies:

14617 Jun 1,2004 07:02 AM Jun 1,2004 11:44 AM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 1, 2004 07:02 AM

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

Administrator [Syncfusion]
Replied On June 1, 2004 08:35 AM

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

Administrator [Syncfusion]
Replied On June 1, 2004 09:06 AM

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

Administrator [Syncfusion]
Replied On June 1, 2004 11:44 AM

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 ???

CONFIRMATION

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.

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.

;