This is a migrated thread and some comments may be shown as answers.

Simple binding to class list does not work

1 Answer 100 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
ManniAT
Top achievements
Rank 2
ManniAT asked on 02 Apr 2008, 06:37 PM
Hi,

with radcombo the same problem as describe here with radlistbox:
http://www.telerik.com/community/forums/thread/b311D-bchmke.aspx

I use a forms.combobox and bind it to a List<MyClass>.
Then I set DisplayMember to the name of a porperty.

In the selectedindexchanged I do:
MyClass selEle=combobox.SelectedValue as MyClass;

And (as expected) I get an object assigned if there is a selected item in the CB.

But always null with RADCombobox


Regards

Manfred

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 03 Apr 2008, 03:58 PM
Hi Manfred Pohler,

As I have replied in the forum post Listbox bound with List<Class> , RadControls for WinForms and the Microsoft controls are similar, but due to the additional range of functionality that RadControls offer, there are certain differences in the API and their behavior.

If you want to get your own custom object, based on a selected item, you should assign the object to the Tag property of the RadComboBoxItem in the ItemDataBound event handher of RadComboBox. For additional information, please refer to our Help Documentation article: RadComboBox >> Databinding >> ItemDataBound event .

I have attached a sample application to demonstrate the approach.

I hope this helps. Please feel free to contact me with other questions you have.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
ManniAT
Top achievements
Rank 2
Answers by
Nikolay
Telerik team
Share this question
or