'assuming treeView1 control has been added to form
'Sample XML
<TREENODES><treenode text="Text to be displayed on page" NodeData="hidden data value associated to displayed text"></treenode></TREENODES>
'Load XML into treeView control static or dynamic
'Static
treeView1.TreeNodeSrc = "TreeViewControl.xml"
'Dynamic
Dim sMyXML as String
Dim myXMLDocument as XmlDocument
'Build your XML string however you need to
sMyXML = "<TREENODES><treenode text=""Text to be displayed on page"" NodeData=""hidden data value associated to displayed text""></treenode></TREENODES>"
myXMLDocument.LoadXML(sMyXML)
treeView1.TreeNodeSrc = myDomDocument.InnerXML
treeView1.DataBind()
'Code for treeView1_SelectedIndexChange
'AutoPostBack property must be set to true for this event to fire on each node select, otherwise the events are queued
dim tnSelectedNode as TreeNode
tnSelectedNode = treeView1.GetNodeFromIndex(treeView1.SelectedNodeIndex)
Response.write("Selected node display text: " & tnSelectedNode.Text & "<br>")
Response.write("Selected node hidden value: " & tnSelectedNode.NodeData & "<br>")