RadComboBox with EnableCheckAllItemsCheckBox=true behaving oddly within Repeater

2 posts, 0 answers
  1. Richard
    Richard avatar
    1 posts
    Member since:
    Oct 2015

    Posted 15 Jan 2016 Link to this post

    I have a Repeater object on my page.  In the Repeater ItemTemplate, I have the following RadComboBox

    <telerik:RadComboBox ID="rcboList"
    runat="server" />

    When this portion of my page is loaded, contents are dynamically loaded to the above combo box, depending on certain criteria.  To further clarify, for each item in the repeater, the contents within rcboList are different.

     All though the contents are different, each repeated RadComboBox should behave the same, with a CheckBox beside each item.  I can populate my lists and I see these check boxes without issue, however, when my user clicks the button to return the data to the server, there is no data in rcboList.CheckedItems.  I figured I tried to iterate over the RadComboBox.Items collection and see if I could get the values from their.

     Interestingly, only the first item in the list is marked as selected, but none of the items are marked as checked.

     Can I use the RadComboBox this way in an asp:Repeater, or is this simply not possible?

     Thank you.

  2. Veselin Tsvetanov
    Veselin Tsvetanov avatar
    595 posts

    Posted 20 Jan 2016 Link to this post

    Hello Richard,

    Thank you for contacting Telerik Support.

    You can use the RadComboBox control in the described scenario. However, it is important to know that getting the checked (or selected) values of each of the RadComboBoxes would be a bit more complicated than the usual.

    Attached you will find a simple web page implementing the scenario. You can see in detail the OnClick event handler of the RadButton control. In it you first get the collection of all controls within the repeater, then you get each of the RadComboBoxes and for each of them you can get its checked values:
    protected void db1_Click(object sender, EventArgs e)
        ControlCollection repeaterItems = Repeater1.Controls;
        string checkedValues = "";
        for (int i = 0; i < repeaterItems.Count; i++)
            Control currentRepeaterItem = repeaterItems[i];
            ControlCollection currentRepeaterItemControlCollection = currentRepeaterItem.Controls;
            RadComboBox currentCombo = (RadComboBox) currentRepeaterItemControlCollection[1];
            var checkedItems = currentCombo.CheckedItems;
            for (int j = 0; j < checkedItems.Count; j++)
                checkedValues += checkedItems[j].Text;
                checkedValues += " ";
        texTitle1.Text = checkedValues;

    I hope that the above answer helps you. If you have any further questions, please do not hesitate to contact us.

    Veselin Tsvetanov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top