This is a migrated thread and some comments may be shown as answers.

Disable items after check.

1 Answer 7 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 11 Jul 2013, 09:01 AM
Hello

I have a radcombobox with 5 items and checkboxes enabled. The user can check two items out of the five. Once the user check two items, i want to disable the rest. Please help with some input. I need javascript.

Thankyou all
Robert

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 11 Jul 2013, 09:57 AM
Hi Robert,

Please have a look at the following JavaScript code I tried which works fine at my end.

JavaScript:
<script type="text/javascript">
    function OnClientItemChecked(sender, args) {
        if (sender.get_checkedItems().length == 2) {
            for (var counter = 0; counter < sender.get_items().get_count(); counter++) {
                var item = sender.get_items().getItem(counter);
                if (item.get_checked() == false) {
                    item.disable();
                }
            }
        }
    }
</script>

Thanks,
Shinu.
Tags
ComboBox
Asked by
Robert
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or