Set "Selected Item" in multiselect RadComboBox

Rahul picture Rahul · Nov 18, 2012 · Viewed 16.3k times · Source

Is there any way we can set Selected Items or Checked Items in a multiselect RadComboBox ?. I want to set value on postback from server.

I tried following code but that works only if it is not a multiselect RadComboBox.

Radbox1.SelectedValue = "123"

My front end code.

<telerik:RadComboBox ID="Radbox1" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Width="300" Height="200" AutoPostBack="True" OnSelectedIndexChanged="Radbox1_SelectedIndexChanged" />

I have value in Radbox1 which will be populated from database.

Thanks, Rahul

Answer

KreepN picture KreepN · Nov 19, 2012

When the Radcombobox is set to allow multiple selections via the checkboxes, you must use each items checked property.

I use a list here to simulate the items that I wish to have marked on postback. You could have this list pre-populated or it could even be loaded from a database:

enter image description here