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 Value- and Display-Members

Thread ID:





107279 Feb 22,2013 06:51 AM Mar 7,2013 06:26 AM WPF 1
Tags: GridControl
Martin Hagenow
Asked On February 22, 2013 06:51 AM


I have a griddatacontrol bound to a DataTable object. One of the datatable columns holds an Int32-Value indicating a status of the row entry.

I managed to display a ComboBox in the column showing this state-Value from an StringCollection:


<syncfusion:GridDataColumnStyle CellType="ComboBox" DropDownStyle="Exclusive">



StringCollection exampleList = new StringCollection();




this.m_dbGrid.VisibleColumns["Wert-Typ"].ColumnStyle.ItemsSource = exampleList;

m_dbGrid.ItemsSource = m_oKommClient.m_dbNormName;

My problem is now, that I can select the Values from the collection in the grid (e.g. One, Two, Three) but bound to the database is the index (e.g. 0, 1, 2). So my selection of the comboboxstring would result in an format exception.

<see attachement>

How can I tell the grid the bind to the values and to diplay the names?

Similar to ComboBox.DisplayMember and ComboBox.ValueMember...

Thanks in advance!





Gobinath A [Syncfusion]
Replied On March 7, 2013 06:26 AM

Hi Martin,

Sorry for the delay caused.

We have analyzed your query and You can set the display member by using below the code snippet.

Code snippet[XAML]:

<sf:GridDataColumnStyle CellType="ComboBox" DisplayMember="DisplayString" ValueMember="Number"/>

Code snippet [C#]:

List<Item> exampleList = new List<Item>();

exampleList.Add(new Item() { DisplayString = "Thousand", Number = 10000 });

exampleList.Add(new Item() { DisplayString = "Thousand One", Number = 10001 });

exampleList.Add(new Item() { DisplayString = "Thousand Two", Number = 10002 });

exampleList.Add(new Item() { DisplayString = "Thousand Three", Number = 10003 });

exampleList.Add(new Item() { DisplayString = "Thousand Four", Number = 10004 });

Sample: WpfApplication1.zip

Please let us know if this helps.


Gobinath A.


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.