Extend TreeView Display Line
Posted on 2006-06-01
I'd like to modify the TreeView so it shows the content of the node as well as the node name.
I can intercept the node in TreeView display of an XMLDocument during TreeNodeDataBound, and see into the source node for the TreeView node display.
Protected Sub TreeView1_TreeNodeDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles TreeView1.TreeNodeDataBound
Dim wrkStr1 As String = e.Node.Value
Dim wrkN As XmlNode = e.Node.DataItem
Dim wrkStr2 As String = wrkN.Name
Dim wrkStr3 As String = wrkN.InnerText
Debug.Print(wrkStr1 & " " & wrkStr3)
But I can't find a way to change the output display....the "e.Node" seems to be pointing at the source, instead of the output (unlike the analogous e.Row for a GridviewRowDataBound event.)
There are many google hits on "customize treeview" and "extend treeview", but there's nothing simple (or at least simple enough for me!)
Any pointers to the essential techniques needed to add an extra field to the TreeView display output (if such exists) would be appreciated.