Madhuri Madhuri -3 years ago 137
ASP.NET (C#) Question

How to clear telerik radcombo box (or) populate with "Empty Message" property value on a function call?

<telerik:RadComboBox ID="rbt" runat="server" Skin="Office2010Black" AllowCustomText="true" CheckBoxes="True" EnableCheckAllItemsCheckBox="true" Width="125px" TabIndex="7" MarkFirstMatch="true" ToolTip="Select" EmptyMessage="Select" Height="100px" Filter="StartsWith">
<telerik:RadComboBoxItem runat="server" Text="High" Value="High" />
<telerik:RadComboBoxItem runat="server" Text="Medium" Value="Medium" />
<telerik:RadComboBoxItem runat="server" Text="Low" Value="Low" />

I tried in code behind:

public void call()
rbt.Text = "Select";

I could not clear selection with the above code. I want to uncheck selected Items of a radcombo box when
function is called. Appreciate if anyone can tell if anything is missing.

Answer Source


using Telerik.Web.UI; 

The following code in code behind resolved my problem of deselecting values of combobox:

public void call()
            if (rbt.CheckedItems.Count > 0)
                    foreach(RadComboBoxItem rcbItem in rbt.Items)
                        rcbItem.Checked = false;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download