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

Set DropDownList.SelectedItem to business object

1 Answer 42 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
David A.
Top achievements
Rank 1
David A. asked on 11 Apr 2011, 12:21 AM
Hi,

We are converting our standard Windows ComboBox controls to the Telerik DropDownList to take advantage of displaying the text property to whatever we want (works great!).  We were previously setting an unbound ComboBox.SelectedItem = myBizObject to select the current value.  However, this does not work with the Telerik DropDownList and setting .Value doesn't apply as the ValueMember is not unique.

Is there a way to manually select the selecteditem like we did with Windows ComboBox?  I tried .SelectedItem.DataBoundItem but that didn't work.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 12 Apr 2011, 05:38 PM
Hello David A.,

Thank you for writing.
 
You cannot set SelectedItem to your business object - you can only set it to the RadListDataItem object. I would suggest modifying slightly your scenario and set SelectedValue.
 
Please, refer to the attached project. I hope this helps.

Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DropDownList
Asked by
David A.
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or