I want to bind a xml external file to a TreeView
, but I want to use the same XMLDataSource
to fill other controls.
So first I want to know what's the best way to do that. Because I think that I will limit the datasource in case of applying a XPath
or TransformFile
to the DataSource
and I will not be able to use it in other controls.
Next, if there's a way of specifying the root node of that xml to bind to the TreeView and if it is possible to hide some of the nodes.
Here is what I've done so far.
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1" ExpandDepth="1" >
<DataBindings >
<asp:TreeNodeBinding DataMember="header" TextField="title"/>
<asp:TreeNodeBinding DataMember="group" TextField="name"/>
<asp:TreeNodeBinding DataMember="item" TextField="text" />
</DataBindings>
</asp:TreeView>