Check/Uncheck RadComboBox items

5 posts, 0 answers
  1. Venkatesh
    Venkatesh avatar
    88 posts
    Member since:
    Nov 2012

    Posted 24 Aug 2016 Link to this post

    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.

  2. Venkatesh
    Venkatesh avatar
    88 posts
    Member since:
    Nov 2012

    Posted 24 Aug 2016 Link to this post

    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>

  3. Venkatesh
    Venkatesh avatar
    88 posts
    Member since:
    Nov 2012

    Posted 24 Aug 2016 in reply to Venkatesh Link to this post

    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>

  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1301 posts

    Posted 26 Aug 2016 Link to this post

    Hello Venkatesh,

    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
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  5. YAMA
    YAMA avatar
    2 posts
    Member since:
    Aug 2017

    Posted 16 Aug in reply to Venkatesh Link to this post

    Solution 2 worked for me. Thank you
  6. YAMA
    YAMA avatar
    2 posts
    Member since:
    Aug 2017

    Posted 16 Aug in reply to Venkatesh Link to this post

    Solution 2 worked for me. Thank you
Back to Top