I have a ASP Dropdown list and Telerik RadComboBox. Both are binding same values.
Now I want to select same value in RadComboBox which user select in ASP Dropdown list.
I have used below codes but RadComboBox always shows previous selcted value only.
5 Answers, 1 is accepted

1. protected void ddlList_SelectedIndexChanged(object sender, EventArgs e)
{
string Name = ddlList.SelectedItem.Text;
rcbComboBox.ClearCheckedItems();
rcbComboBox.Text = string.Empty;
rcbComboBox.Text = Name;
rcbComboBox.Items.FindItemByText(Name).Checked = true;
rcbComboBox.Items.FindItemByText(Name).Selected = true;
}
2. protected void ddlList_SelectedIndexChanged(object sender, EventArgs e)
{
rcbComboBox.Text = string.Empty;
rcbComboBox.Text = Name;
foreach (RadComboBoxItem rcbItem in rcbComboBox.Items)
{
if (rcbItem.Text == Name)
{
rcbItem.Checked = true;
}
else
{
rcbItem.Checked = false;
}
}
}
ComboBox:
<telerik:RadComboBox ID="rcbComboBox" runat="server" CheckBoxes="true" OnItemChecked="rcbComboBox_ItemChecked" AutoPostBack="true"
EmptyMessage="Qualifier Filter" DataTextField="OWNER_TYPE" OnItemDataBound="OnItemDataBound" AllowCustomText="true" >
</telerik:RadComboBox>
DropDownList:
<asp:DropDownList ID="ddlList" OnSelectedIndexChanged="ddlList_SelectedIndexChanged" AutoPostBack="true" DataTextField="OWNER_TYPE" DataValueField="OWNER_TYPE" runat="server" Width="70px">
</asp:DropDownList>

1. protected void ddlList_SelectedIndexChanged(object sender, EventArgs e)
{
string Name = ddlList.SelectedItem.Text;
rcbComboBox.ClearCheckedItems();
rcbComboBox.Text = string.Empty;
rcbComboBox.Text = Name;
rcbComboBox.Items.FindItemByText(Name).Checked = true;
rcbComboBox.Items.FindItemByText(Name).Selected = true;
}
2. protected void ddlList_SelectedIndexChanged(object sender, EventArgs e)
{
rcbComboBox.Text = string.Empty;
rcbComboBox.Text = Name;
foreach (RadComboBoxItem rcbItem in rcbComboBox.Items)
{
if (rcbItem.Text == Name)
{
rcbItem.Checked = true;
}
else
{
rcbItem.Checked = false;
}
}
}
ComboBox:
<telerik:RadComboBox ID="rcbComboBox" runat="server" CheckBoxes="true" OnItemChecked="rcbComboBox_ItemChecked" AutoPostBack="true"
EmptyMessage="Qualifier Filter" DataTextField="OWNER_TYPE" OnItemDataBound="OnItemDataBound" AllowCustomText="true" >
</telerik:RadComboBox>
DropDownList:
<asp:DropDownList ID="ddlList" OnSelectedIndexChanged="ddlList_SelectedIndexChanged" AutoPostBack="true" DataTextField="OWNER_TYPE" DataValueField="OWNER_TYPE" runat="server" Width="70px">
</asp:DropDownList>
At my end your code works correctly: after selecting an item in the asp:DropDownList the item with the same Text in the ComboBox is checked. Here's a short video that demonstrates this.
I attached a sample runnable page, in which I tested your code. Note also that if CheckBox support is enabled the ComboBox items' Checked property has to be used instead of Selected.
Regards,
Ivan Danchev
Telerik by Progress

