use jQuery to disable checkboxes in RadComboBox

3 posts, 1 answers
  1. Jeremy
    Jeremy avatar
    14 posts
    Member since:
    Mar 2012

    Posted 23 Mar 2012 Link to this post

    I have a RadListView that has an ItemTemplate that contains a RadComboBox. As such, the IDs of the combo boxes are dynamically generated, so this will not work for me:

    var rcbAssigneeObject = $find("<%=rcbAssignee.ClientID %>");

    . What I'm trying to do is apply some business logic to what can and cannot be selected. I'm having trouble targetting the items in the listbox. When a check box is selected, I need to use jQuery to select all items in the combobox, then check the value of an attribute that is part of the object loaded into the datasource on page load called "type". If this type is equal to, say, "person", then I need to disable all items in the combobox other whos type is "group". I've started with something like this:

            function () {
                var allItems = $(this).closest(".rcbList").find(".rcbItem");
                //check item types here

    I'm stuck on where to go from here. I seem to be unable to access any sort of item client id in order to create an asp object that allows me to manipulate the telerik object. For instance, if I were to just grab the item like:

    var myItem = $(this).closest(".rcbItem").attr("id");

    it would return null for that field. And if i try to get the id of the parent above that, I also get null.

    Any ideas?

    Or at the very least, how do I obtain the RadComboBox item starting at the checkbox OnClick event. For instance

    var rcb = $(this).pathToRadComboBoxControl().Get();

    The from there, how do i iterate through the item collection. is there a method like rcb.get_items().each(...);  ??
  2. Jeremy
    Jeremy avatar
    14 posts
    Member since:
    Mar 2012

    Posted 23 Mar 2012 Link to this post

  3. Answer
    Kalina avatar
    918 posts

    Posted 29 Mar 2012 Link to this post

    Hi Jeremy,

    I am suggesting you a easier way to implement your business logic.
    You can handle the RadComboBox OnClientItemChecked event that fires every time a checkbox is checked.
    Then you can loop through combo box items and enable (or disable) them in this manner:
    <script type="text/javascript">
        function OnClientItemChecked(sender, eventArgs) {
            var items = sender.get_items();
            for (i = 0; i < items.get_count(); i++) {
                var item = items.getItem(i);
                if (item.get_attributes().getAttribute("Type") == "someValue")
    <telerik:RadListView ID="RadListView1" runat="server"
    <telerik:RadComboBox ID="RadComboBox1" runat="server"
        CheckBoxes="true" OnClientItemChecked="OnClientItemChecked">

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top