locked
RadCombobox method ClearSelection is not working in asp.net RRS feed

  • Question

  • User355715116 posted

    I am trying to clear a radcombox previously selected value based on some condition.

    but in my code radComboBox.ClearSelection(); is not working and clearing the previously selected result. What can be the best alternative of ClearSelection(); here to clear my radcombobox's previously selected result?

    Wednesday, September 9, 2020 2:35 PM

All replies

  • User-939850651 posted

    Hi mazharul007,

    I am afraid that there is not enough environment to test your code. If you use Telerik RadCombobox, you could try to set it as a selection directly after adding an option without clearing the current selection.

    RadCombobox can only select one item at a time. If no item is currently selected, then the Selected property of all items will be False. Setting the Selected property of one item to True automatically sets the Selected property of all other items in RadComboBox to False.

                //add new Item to RadCombobox
                RadComboBoxItem item = new RadComboBoxItem();
                item.Text = positionName;
                item.Value = positionId;
                ddlPosition.Items.Add(item);
                //set selected option
                RadComboBoxItem item = ddlPosition.FindItemByText(positionName);
                item.Selected = true;

    And the use of this control is different from ordinary ComboBox. Please refer to this document for more details.

    Hope this can help you.

    Best regards,

    Xudong Peng

    Thursday, September 10, 2020 5:45 AM