hey there i have made a tree view control and i am having a problem that my data is not displaying on the screen can any body solve my problem
here below is the code
now below is the xml file names "treedata.x ml"
below is the page load function
thanxxx regards furqi
here below is the code
Code:
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/treedata.xml" XPath="\treedata" TransformFile="~/App_Data/xslfile.xslt"></asp:XmlDataSource> <asp:TreeView ID="PageTreeView" runat="server" DataSourceID="XmlDataSource1" ExpandDepth="5" onselectednodechanged="TreeView1_SelectedNodeChanged" ShowLines="True"> <DataBindings> <asp:TreeNodeBinding DataMember="genre" TextField="name" /> <asp:TreeNodeBinding DataMember="book" TextField="title" /> <asp:TreeNodeBinding DataMember="title" FormatString="ISBN: {0}" TextField="ISBN" /> <asp:TreeNodeBinding DataMember="price" FormatString="${0}" TextField="#InnerText" /> <asp:TreeNodeBinding DataMember="comments" Text="Comments" Value="Comments" /> <asp:TreeNodeBinding DataMember="userComment" TextField="#InnerText" ToolTipField="rating" /> </DataBindings> </asp:TreeView>
now below is the xml file names "treedata.x ml"
Code:
<bookstore> <genre name="fiction"> <book ISBN="10-000000-001" title="The Iliad and The Odyssey"> <title ISBN="10-000000-001">The Iliad and The Odyssey</title> <price>12.95</price> <comments> <userComment rating="4">Best translation I've read.</userComment> <userComment rating="2">I like other versions better.</userComment> </comments> </book> <book ISBN="10-000000-999" title="Anthology of World Literature"> <title ISBN="10-000000-999">Anthology of World Literature</title> <price>24.95</price> <comments> <userComment rating="3">Needs more modern literature.</userComment> <userComment rating="4">Excellent overview of world literature.</userComment> </comments> </book> </genre> <genre name="nonfiction"> <book ISBN="11-000000-002" title="Computer Dictionary"> <title ISBN="11-000000-002">Computer Dictionary</title> <price>24.95</price> <comments> <userComment rating="3">A valuable resource.</userComment> </comments> </book> <book ISBN="11-000000-003" title="Cooking on a Budget"> <title ISBN="11-000000-003">Cooking on a Budget</title> <price>23.95</price> <comments> <userComment rating="4">Delicious!</userComment> </comments> </book> </genre> </bookstore>
Code:
protected void Page_Load(object sender, EventArgs e) { XmlDataSource1.XPath = "treedata.xml"; PageTreeView.DataBind(); }