Set DropDownList.SelectedItem to business object

2 posts, 0 answers
  1. David A.
    David A. avatar
    126 posts
    Member since:
    Aug 2008

    Posted 10 Apr 2011 Link to this post

    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!
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 12 Apr 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top