asp.net - Bind XML to Controls -
i want bind xml external file treeview
, want use same xmldatasource
fill other controls.
so first want know what's best way that. because think limit datasource in case of applying xpath
or transformfile
datasource
, not able use in other controls.
next, if there's way of specifying root node of xml bind treeview , if possible hide of nodes.
here i've done 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>
the answer question in doing these 2 things:
read xml reusable object. think of dataset best alternative you. way data once read dataset can reused bind other objects well. here link can find example of how read xml data set. http://www.codeproject.com/articles/10427/convert-xml-data-to-dataset-and-back
the other part bind dataset tree view, here example that: http://www.codeproject.com/articles/25753/binding-the-asp-net-treeview-to-a-dataset-or-an-ob
the issue second part data set structure may not appropriate binding tree view in case can filter data further.
Comments
Post a Comment