PDA

Click to See Complete Forum and Search --> : Populate treeview from dataset


venerable bede
Nov 18th, 2002, 06:49 AM
In a webform how do I populate a treeview from a dataset?

All the examples seem to use xml.

Thanks in Advance

Negative0
Nov 21st, 2002, 02:09 PM
Just loop through the dataset and add items to the treeview programmatically.

There is no simple way like Treeview1.Data= YourDataSet, so you just have to do something like:



'I dont know the specific code for adding to a treeview, but it would be somthing like this
Dim tItem as TreeViewItem
For x = 0 to ds1.Rows.Count-1


tItem = New TreeViewItem
tItem.text = ds1.Rows(x).Item(0).ToSTring()
TreeView1.Items.Add(tItem)
Next