Results 1 to 2 of 2

Thread: Populate treeview from dataset

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Populate treeview from dataset

    In a webform how do I populate a treeview from a dataset?

    All the examples seem to use xml.

    Thanks in Advance

    Parksie

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    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:


    VB Code:
    1. 'I dont know the specific code for adding to a treeview, but it would be somthing like this
    2. Dim tItem as TreeViewItem
    3. For x = 0 to ds1.Rows.Count-1
    4.  
    5.  
    6. tItem = New TreeViewItem
    7. tItem.text = ds1.Rows(x).Item(0).ToSTring()
    8. TreeView1.Items.Add(tItem)
    9. Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width