najamallaial
New Member
Lets say I have an XDocument something like this\[code\]<Root><product Value= "http://stackoverflow.com/questions/12767446/P1"><Customer Value = "http://stackoverflow.com/questions/12767446/Cus1"><Description Value = "http://stackoverflow.com/questions/12767446/desc1"><CreationDate Value = "http://stackoverflow.com/questions/12767446/DT1"></CreationDate><CreationDate Value = "http://stackoverflow.com/questions/12767446/DT2"></CreationDate></Description><Description Value = "http://stackoverflow.com/questions/12767446/desc2"><CreationDate Value = "http://stackoverflow.com/questions/12767446/DT3"></CreationDate></Description></Customer><Customer Value = "http://stackoverflow.com/questions/12767446/Cus2">....</Customer></product><product Value ="http://stackoverflow.com/questions/12767446/P2">....</product></Root>\[/code\]Now this XDocument is dynamic in nature. I am building this from a datasource at runtime, i.e. I will not know the element names(product, Customer, Description, CreationDate etc) or the depth of the nodes.I need to bind this xml document in a asp.net treeview. How do I bind it so that the attribute values are displayed in the treeview node text and when I click a node, say "desc1", I get all its parent node values (i.e. Customer = "cus1" and product = "P1") so that I will generate a query with these conditions and show the resultant data in a gridview.