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

Access the Containing Node of a Templated Control

2 Answers 41 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Marbry
Top achievements
Rank 1
Marbry asked on 05 Jun 2012, 06:23 PM
Is there a way to reference the containing tree node of a template generated control on the client side, a radcombobox in this case?  Without using the Find methods.

Those depend on knowing a particular value rather than the relationship of the node and control.  I have a client function that is a handler for the radcombobox OnClientSelectedIndexChanged event, but within that I need to also get a reference to the containing tree node.

2 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 08 Jun 2012, 07:53 AM
Hello Marbry,

The TreeView has a function that can get a reference to the node object if you pass in any of the elements inside the node as an argument. In your case, you can use this function in the following way:
function onClientSelectedIndexChanged(sender, args) {
    var comboElement = sender.get_element();
    var tree = $find("RadTreeView1");
    var node = tree._extractNodeFromDomElement(comboElement);
    console.log(node.get_text());
}

 
Regards,
Bozhidar
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.
0
Marbry
Top achievements
Rank 1
answered on 08 Jun 2012, 01:45 PM
Perfect, that's exactly what I needed.

Thank you.
Tags
TreeView
Asked by
Marbry
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Marbry
Top achievements
Rank 1
Share this question
or