[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 891
  • Last Modified:

Binding xml data to TreeView control?

Can anyone provide a code sample on how to bind xml data to a TreeView control. (Or any other control, but I want to be able to expand and collapse nodes)

The structure of the xml data is not known/not pre-defined, it varies a lot.
0
dj_user2
Asked:
dj_user2
1 Solution
 
aprestoCommented:
This should help. Once you bind to the tree view control, you wll have all of the functionality of that control available to you as long as the data structure you provide enforces some kind of heirarchy
http://www.c-sharpcorner.com/UploadFile/manishkdwivedi/treeviewcontrol01072008003526AM/treeviewcontrol.aspx 
0
 
rajeeshmcaCommented:
HI dj_user2,

Refer the following link. This contains how to bind xml with treeview, both static and dynamic

http://www.15seconds.com/issue/041117.htm
0
 
aplusexpertCommented:
Hi,

Just load dataset from XML file and bind with tree view control.

Thanks.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
dj_user2Author Commented:
Like mentioned in the OP, we don't know what nodes, values, and attributes the xml data has. Both links assumes xml data format is known to the user.

Binding the xml data to the treeview is displaying just the node names, not the node values.
0
 
rajeeshmcaCommented:
this link does have the way of creating dynamic nodes
check it out
http://www.15seconds.com/issue/041117.htm
0
 
dj_user2Author Commented:
Being able to create notes dynamically is not our requirement. We already have all the data in xml format. I just want to bind it to the tree view control, and be able to expand, collapse, view all the nodes and values.

The article you mentioned creates nodes dynamically from a database table, looping through each row and each field.
0
 
dj_user2Author Commented:
if there is no way to bind xml data to treeview control straight up, I may have to create nodes dynamically; read each xml node, create a tree node, and add it to the treeview control. That's the code sample I am asking for.
0
 
DagdasonCommented:
Which version of .NET Framework? The newer versions are a bit more complicated than .NET 1.1
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now