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

Confused about RadComboBox SelectedItem

1 Answer 45 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 16 Feb 2012, 12:53 AM
I have a RadComboBox that has an "EmptyMessage" set. When initially displayed the EmptyMessage shows until the user Selects an item. This is as I expect.

If, during the course of interaction, the user adds a new widget, I can add a RadComboBoxItem to the RadComboBox Items collection and sort the collection and I can set the "Selected" property of the RadComboBoxItem I added.. But when the user deletes a widget, I delete the widget RadComboBoxItem from the Items collection, but I want the RadComboBox to have nothing selected and to again show the "EmptyMessage".

All this is happening on the server side - how can I achieve my desired result?

SelectedIndex and SelectedItem are both read only, so setting them to -1 or null respectiviely doesn't work. I can 't be the only person trying to do something like this.And yet I can't find an example of how to achieve this anywhere.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 20 Feb 2012, 10:07 PM
Hello Martin,

You could add a default item to the RadComboBox's items collection and set it as selected whenever an item is deleted. This approach is explained in the following help article: Insert a default item when databinding RadComboBox.

Regards,
Ivana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
ComboBox
Asked by
Martin
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or