B
Brian Nicholson
Hello -- I'm having problems figuring out how to bind an XML file to a
treeview control. I have the following test XML:
<?xml version="1.0" encoding="utf-8"?>
<instruments>
<instrument name="Name1" type="Type1" path="Path1" />
<instrument name="Name2" type="Type2" path="Path2" />
<instrument name="Name3" type="Type3" path="Path3" />
</instruments>
And I try databinding it to the TreeView with the following:
Dim xmlds As New XmlDataSource()
xmlds.DataFile = Server.MapPath("test.xml")
treeSrc.DataSource = xmlds
treeSrc.DataBind()
The problem is that the items appear in the tree like this:
instruments
instrument
instrument
instrument
But I would instead rather have them appear like this:
Name1 [Type1]
Name2 [Type2]
Name3 [Type3]
I figure I'll have to implement custom data binding, but I can't figure out
how.
Thanks for your help.
treeview control. I have the following test XML:
<?xml version="1.0" encoding="utf-8"?>
<instruments>
<instrument name="Name1" type="Type1" path="Path1" />
<instrument name="Name2" type="Type2" path="Path2" />
<instrument name="Name3" type="Type3" path="Path3" />
</instruments>
And I try databinding it to the TreeView with the following:
Dim xmlds As New XmlDataSource()
xmlds.DataFile = Server.MapPath("test.xml")
treeSrc.DataSource = xmlds
treeSrc.DataBind()
The problem is that the items appear in the tree like this:
instruments
instrument
instrument
instrument
But I would instead rather have them appear like this:
Name1 [Type1]
Name2 [Type2]
Name3 [Type3]
I figure I'll have to implement custom data binding, but I can't figure out
how.
Thanks for your help.