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

DataBoundGrid ComboBox Question

Thread ID:





14617 Jun 1,2004 11:02 AM UTC Jun 1,2004 03:44 PM UTC WinForms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On June 1, 2004 11:02 AM UTC

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

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

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


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