radgridcombo: get checkbox value in JS

1 posts, 0 answers
  1. Kid
    Kid avatar
    1 posts
    Member since:
    Aug 2010

    Posted 21 Dec 2010 Link to this post

    Hello,

    I have a RadGridCombo populated with checkbox items. When I click a specific item, I want to enable another RadGridCombo box. My problem in my javascript code is I'm unable to retrieve the value of the checkbox item I click. Take a look:

    function onCheckBoxClick(chk)
                { 
                    // YEEAAH JAVASCRIPT PROGGING!!!1
                    var combo = $find("<%= cboPolicyScope.ClientID %>");
                    var agencylist = $find("<%= cboUserAgencies.ClientID %>");
                    
                    //holds the text of all checked items
                    var text = "";
                    //holds the values of all checked items
                    var values = "";
                    //get the collection of all items
                    var items = combo.get_items();
                    //enumerate all items
                    for (var i = 0; i < items.get_count(); i++)
                    {
                        var item = items.getItem(i);
                        var values = $telerik.findValue(item.get_value(), "cboScope");
                        //get the checkbox element of the current item
                        var chk1 = $get(combo.get_id() + "_i" + i + "_cboScope");
                        if (values == "*")
                        {
                            agencylist.enable();
                            break;
                        } else {
                            agencylist.disable();
                        }
                    }
                }
    function onCheckBoxClick(chk)
                {
                    var combo = $find("<%= cboPolicyScope.ClientID %>");
                    var agencylist = $find("<%= cboUserAgencies.ClientID %>");
                     
                    //holds the text of all checked items
                    var text = "";
                    //holds the values of all checked items
                    var values = "";
                    //get the collection of all items
                    var items = combo.get_items();
                    //enumerate all items
                    for (var i = 0; i < items.get_count(); i++)
                    {
                        var item = items.getItem(i);
                        var values = $telerik.findValue(item.get_value(), "cboScope");
                        //get the checkbox element of the current item
                        var chk1 = $get(combo.get_id() + "_i" + i + "_cboScope");
                        if (values == "*")
                        {
                            agencylist.enable();
                            break;
                        } else {
                            agencylist.disable();
                        }
                    }
                }


    Ignore the unused variables, I was trying to finagle a method to get the data but no success. Anyone know a better way to do this? 

    Thanks very much for any help -- I've looked over every source regarding RadGridCombo and the demos/templates.
Back to Top