telerikclient-sidecheckboxlistradlistbox

Telerik client event - find out who is the sender


I have a javascript function that is called on "OnClientSelectedIndexChanged" event from a RadListBox element. The same function can be fired on the "OnClientItemChecked" event in case the RadListBox has the property checkBox == true. How can I find if the function was called on item check or selection changed? I need to get the value of the element like this:

function getVal(sender, args) {
    var Item = args.get_item();
    var ItemType = [...] // here shold be the senders type
    if(ItemType == CHECKBOX){
        if(Item.get_checked()) return Item.get_value();
        else return null;
    } else {
        return Item.get_value();
    }
}

Thanks!


Solution

  • function getVal(sender, args) 
    {
        var Item = args.get_item();
    
        if (args.get_domEvent().target.className == "rlbCheck")
        {
            //this is checkbox
            if (Item.get_checked()) return Item.get_value();
            else return null;
        } else {
            return Item.get_value();
        }
    }