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

radgridcombo: get checkbox value in JS

0 Answers 72 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Kid
Top achievements
Rank 1
Kid asked on 21 Dec 2010, 07:39 PM
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.

No answers yet. Maybe you can help?

Tags
Ajax
Asked by
Kid
Top achievements
Rank 1
Share this question
or