Consider the following XML fragment...
<channel>
...
<item>
<title>John</title>
...
</item>
<item>
<title>Jane</title>
...
</item>
</channel>
When the file is loaded into the TreeView control and a <title> node is selected I have no idea how to determine how to identify which parent the <title> actually descends from.
The TreeNode.Parent property returns the value of the node's parent. The value would be 'item' but I need to identify which parent and which item as there are multiple instances of the <item> element in the file which have the same value.
The broader objective is to determine which node has been selected to enable editing the data in the selected node.
Please paste your code if handy but advising me of the right methodology or referral to documents will be just as appreciated. Thanks for your comments...
<%= Clinton Gallagher

Which node was selected?
Ron Walker
XyMeXian Archer
GetParent(MyTreeview, MyNode).
Private Function GetParent(ByVal Treeview1 As TreeView, ByVal node As TreeNode, _ Optional ByVal startNode As TreeNode = Nothing, _ Optional ByRef gotIt As Boolean = False) As TreeNode Dim MyNodeCollection As TreeNodeCollection Dim TempNode As TreeNode Dim TempGotIt As Boolean ' start from where If startNode Is Nothing Then
MyNodeCollection = TreeView1.Nodes
ElseMyNodeCollection = startNode.Nodes
End If ' loop through the nodes collection For Each nd As TreeNode In MyNodeCollection ' got it If nd.GetNodeIndex = node.GetNodeIndex Then If startNode Is Nothing ThengotIt =
True Return Nothing ElsegotIt =
True Return startNode End If End If ' if not get it, then search in child nodesTempNode = GetParent(Treeview1, node, nd, TempGotIt)
If TempGotIt = True Then Return TempNode End If Next End FunctionDino Ablakovic
I didn't see a GetParent method %-( Thanks Kishore.
Imti