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

Determining if node is parent or child

2 Answers 194 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Brendan Vogt
Top achievements
Rank 1
Brendan Vogt asked on 12 May 2010, 01:52 PM
Hi,

I have a treeview with the multiple select option set to true.  Each parent node has a couple of child nodes as such:

Parent Node 1
  - Child Node 1
  - Child Node 2
  - Child Node 3
Parent Node 2
  - Child Node 1
  - Child Node 2
  - Child Node 3
Parent Node 3
  - Child Node 1
  - Child Node 2
  - Child Node 3

A user can select a parent node, and a child node from another parent.  I have code here that tells you if the node is selected or not.  How do I check if the selected node is a parent node or a child node?

Please can someone advise?

Thanks
Brendan

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 12 May 2010, 02:12 PM
Hello Brendan,

You can check for the "Level" of the node, where Level denotes the level of the Node in the TreeView structure. You could simply get the level by using the Level property of node. Root Nodes are at level 0, their children Nodes - at 1 and so on.

If you want to check for the level from client side, then use the 'get_level()' method of node's client object.

Thanks,
Princy.
0
Brendan Vogt
Top achievements
Rank 1
answered on 12 May 2010, 02:17 PM
Thanks a lot.
Tags
TreeView
Asked by
Brendan Vogt
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Brendan Vogt
Top achievements
Rank 1
Share this question
or