How do I get the full path of TreeNode, all the way from the Root node? Each TreeNode has a property ValuePath which gives the full path of TreeNode from the
Root node. All node values, from the Root node, are appended with a separator. Each node
value is separated by the PathSeparator attribute of TreeView control. Here is an example:
<asp:TreeView ID="tvw" runat="server" PathSeparator="\">
<Nodes>
<asp:TreeNode Text="C:" Value="C:">
<asp:TreeNode Text="Abc" Value="Abc"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
void tvw_SelectedNodeChanged(object sender, EventArgs e)
{
Response.Write(tvw.SelectedNode.ValuePath);
}
|