Disable items after check.

2 posts, 0 answers
  1. Robert
    Robert avatar
    12 posts
    Member since:
    May 2013

    Posted 11 Jul 2013 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Jul 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top