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

ComboBox + Arraylist <-- Object

Hallo! I have a little problem. Column 6 (for example) have a ColStyles ComboBox. The Datasource for this Column is an Arraylist. This Arraylist contains a object with two values (id and text). now the problem ;-) Set the Datasource, Dosplaymember and Valuemember. mygrid.ColStyles(6).DataSource = MyArraylist mygrid.ColStyles(6).DisplayMember = "text" mygrid.ColStyles(6).ValueMember = "id" the combobox shows me now the Member "text" OK! it work. but if i change the comboboxitem, the valuemeber is every time "id". example: selection --> car ("text") --> return "id" and not (2) selection --> plane("text") --> return "id" and not (3) can you help me? thanks a lot. (sorry! my english is not so beautiful)

4 Replies

AD Administrator Syncfusion Team October 20, 2003 12:05 PM UTC

Hallo Boris, When you want to determine the value that was selected you need to check the style.CellValue property, not the style.ValueMember. style.CellValue will have the id value (2) style.FormattedText will have text (e.g. "plane") Stefan


BJ Boris Jansen October 21, 2003 03:27 AM UTC

Thanks, but is doesn`t work. if i ask for the cellvalue, the grid returns me the text inside the cell (e.g. "bike") but not the id. any idea! Thanks a lot. Boris


AD Administrator Syncfusion Team October 21, 2003 08:00 AM UTC

It should ... Try take a look at the sample in Grid\Samples\CellTypes\ComboBoxCells. You can modify it and send me your code changes. Then I can take a look what might be wrong. Stefan


AD Administrator Syncfusion Team October 21, 2003 08:20 AM UTC

Attached is a minimal sample that I think is set up the way you described. If you set a value in cell 1,1, and then click the button, it seems to chow the CellValue and FormattedText as expected. What are you doing differently?

Loader.
Live Chat Icon For mobile
Up arrow icon