Search code examples
c#winformsdevexpressxtratreelist

how to get parent node index when parent node is inserted at runtime in treelist?


I've added parent node at runtime as

TreeListNode parentNode1 = treeList1.AppendNode(new object[] { "BuiltIn Groups"}, null);

But now i want to insert child node under particular parent node. In my application when user right click on particular parent node then i shown a menu & when user selects to insert new child node under selected parent node then i used the same treeList1.AppendNode() method but this method require second parameter as parent node index & i'm getting that parent node index when i insert parent node at run time.

Can u suggest something about this issue?

thanks.


Solution

  • The following code should work for you:

        TreeListNode parentNode = treeList1.AppendNode(..., null);
        TreeListNode childNode = treeList1.AppendNode(..., parentNode);