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

Get Parent and Child Index of TreeNode

2 Answers 155 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Dale Palmer
Top achievements
Rank 1
Dale Palmer asked on 18 Jul 2008, 06:07 PM
Hi,

I'm trying to fire an an OnNodeCheck event from Javascript when the node is selected using the following code:

function

RadTreeView1_OnNodeClick(sender, eventArgs)

{

var tree = $find("ctl00_Main_RadTreeView1");

var node = tree.get_selectedNode();

if(node)

{

node.expand();

if (node.get_value() != '-1')

{

if(node.get_checked())

{

//node.set_checked(false);

node.uncheck();

}

else

{

node.set_checked(true);

node.check();

 

__doPostBack('ctl00$Main$RadTreeView1', '{"commandName":"Check","index":"1:0"}');

}

}

}

}

This is the only way that I can seem to get the code to fire, however I can't seem to find the index of the checkbox I'm firing the code from. Is there a method to pull the placement index of the child node, eg. 1:0 from the inbuilt methods or am I going to have to add a loop to the treeview to try and build this manually?

Any help would be greatly appreciated.

Cheers

Dale

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 21 Jul 2008, 07:22 AM
Hi Dale Palmer,

The index "1:0" is created by the internal JavaScript routine _getHierarchicalIndex (a method of the RadTreeNode client-side object).

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Dale Palmer
Top achievements
Rank 1
answered on 21 Jul 2008, 09:02 AM
Thanks Albert, that;'s sorted it

Cheers

Dale
Tags
TreeView
Asked by
Dale Palmer
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Dale Palmer
Top achievements
Rank 1
Share this question
or