RadComboBox with checkboxes

7 posts, 0 answers
  1. berto
    berto avatar
    40 posts
    Member since:
    Jul 2012

    Posted 19 Aug 2012 Link to this post

    I implemented this successfully, i have only issue with error handling if no checkbox will be checked. Any suggestions how the easiest I can solve this issue?
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 20 Aug 2012 Link to this post

    Hello Adnrej,

    Could you elaborate a bit more about the scenario you are trying to achieve? Do you mean to implement a validation if there are no items checked in RadComboBox?


    Regards,
    Nencho
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. berto
    berto avatar
    40 posts
    Member since:
    Jul 2012

    Posted 20 Aug 2012 Link to this post

    Yes, this is exactly what I need. I have to be sure that at least one item will be checked.
  5. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 21 Aug 2012 Link to this post

    Hello Andrzej,

    In order to implement the desirable validation, you could perform a verification if there are any items checked with the client method get_checkedItems of the RadComboBox object, or you could check if the CheckedItems.Count is greater than 0 at server side. Please consider the following approach implemented at client side, at the event handler of an RadButton, considering there are two RadComboBoxes to validate:
    function onClientClicked() {
                var noErrors = true;
                var label = document.getElementById("label");
                for (i = 0; i < 2; i++) {
     
                    if (Telerik.Web.UI.RadComboBox.ComboBoxes[i].get_checkedItems().length < 1) {
                        noErrors = false;
                    }
                }
                if (!noErrors)
                    label.textContent = "Fill all RadComboBoxes";
                else
                    label.textContent = "";
            }

    All the best,
    Nencho
    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.
  6. Matt
    Matt avatar
    49 posts
    Member since:
    Jun 2012

    Posted 24 Jul 2013 Link to this post

    I'm trying to use JQuery to get the value of a specific checkbox but I can't find any documentation for get_checkedItems() for a RadComboBox anywhere.

    Could you post a working link to it??
  7. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 24 Jul 2013 Link to this post

    Hello,

    Please use the below code to find checked items of combobox in client side

    var $ = $telerik.$;
     
    function validate(sender, eventArgs)
    {
            var combo = $find("<%= RadComboBox3.ClientID %>");
            if (combo.get_checkedItems().length < 1) {
          alert("Please select atleast one item");
         }
    }


    For reference please check the below link
    1) ClientSide Basics
    2) RadComboBox Object


    Thanks,
    A2H
  8. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 24 Jul 2013 Link to this post

    Hello,

    Please use the below code snippet to find the checked items in combobox on client side

    var $ = $telerik.$;
                function validate(sender, eventArgs) {
                    var combo = $find("<%= RadComboBox3.ClientID %>");
                    if (combo.get_checkedItems().length < 1) {
                        alert("Please select atleast one item");
                    }
                }


    Please refer this link for reference

    Thanks,
    A2H
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017