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

GridDataControl ComboBox Data Binding

Hello

1. I created a griddatacontrol and data binded the itemsource and datacontext to an entityframeworkmodel like so:
private ExampleEntities context = new ExampleEntities();

this.ExampleGridDataControl.DataContext = this.context.Examples.ToList();



2. I then created a comboBox column like so:







3. And set the comboBox itemsSource:

StringCollection exampleList = new StringCollection();
exampleList.Add("Example1");
exampleList.Add("Example2");
exampleList.Add("Other");
this.ExampleGridDataControl.VisibleColumns[1].ColumnStyle.ItemsSource = exampleList;

4. When I load the gridDataControl, the comboBoxes cell values correspond to the actual values in the entityframework, however when I tried to change the values from the combo box, I get an error:
"Unable to cast object of type 'Syncfusion.Windows.Controls.Grid.HoverListBoxItem' to type 'System.String'.

Are there any specific ways I would need to dataBind the ComboBox column? It seems that there's an error converting the values back to the binding context. Please help.

Thank you



1 Reply

KA Kamalakannan A Syncfusion Team November 22, 2010 10:11 AM UTC

Hi Elisha

Sorry for the delay caused.

We have created a sample and checked with your reported issue. We are able to reproduce the issue from our sample. Please create an new incident from the following link to get the updates and the fix for the issue.

Direct Trac: http://www.syncfusion.com/support/directtrac/dtnewpost

Sample reproduces the issue: CS - Copy161285244.zip

Please let us know if you need any details.

Regards,
Kamal.



Loader.
Live Chat Icon For mobile
Up arrow icon