Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Wintree DataSource
posted

I am very new to WinTree.   

My project has a UserControl tree I have  been able to code the creation of the tree with static parent and child nodes. 

Basicly useing:

        Dim treeBatchNav As UltraTree
        Dim node As UltraTreeNode
        Dim childNode As UltraTreeNode
        treeBatchNav = New UltraTree

        With treeBatchNav

            node = .Nodes.Add("Claim Node 1 TEST") 'Claim Number
            ' Add some child nodes for claim pages.
            childNode = node.Nodes.Add("Page node 1TEST") 'Claim Page
            childNode = node.Nodes.Add("Page node 2TEST") 'Claim Page
            childNode = node.Nodes.Add("Page node 3TEST") 'Claim Page
            childNode = node.Nodes.Add("Page node 4TEST") 'Claim Page

            ' Add root nodes for claim numbers
            node = .Nodes.Add("Claim Node 2TEST") 'Claim Number
        End With
        group.Container.Controls.Add(treeBatchNav)

 

Now I want to create these based off of a datasource well two if I can. 

I have a tableadapter that lists claim numbers.  For each claim number that is returned I want that to be a parent node.

Under each Parent node.  I would like to reach out to a second tableadapter that has the pages listed.
I would create a child Node for each page. (I can hard code the pages if I have too.) 

So this is what I envision but can not find help on hardcoding datasources in VB. 

With treeBatchNav
   With claimdatasource
       whilenot eof
              node = .Nodes.Add(claimnumbercolumnvalue) 'Claim Number
                With pagedatasource
                    whilenot eof
                         childNode = node.Nodes.Add(pagecolumnvalue) 'Claim Page
                    move.next
                End With
        move.next
   End With
End With

 

I am guessing completely off base on how to even acomplish this.  Please point me to the appropriate help documents or help me out here.

 

 

Parents
No Data
Reply
  • 1475
    Verified Answer
    posted

    Loop through the first dataset having claim info and create parent node. Before adding the node to the tree loop through dataset having page information and add as many child nodes as the rows in the dataset. Then add the child nodes to the parent node and finally add the parent node to the tree.

     Here is a sample code.

    For
    Each mvarDataRow As DataRow In Me.claimdatasource.Tables(0).Rows

    Dim wfNode As New UltraTreeNode

    Me.utWorkFlow.Nodes.Add(wfNode)

    wfNode.Key = mvarDataRow("claimnumber")

    wfNode.Text = mvarDataRow("claimnumber")

    wfNode.Tag = mvarDataRow("claimnumber")

    Dim childNode As Infragistics.Win.UltraWinTree.UltraTreeNode

    If Not pagedatasource Is Nothing AndAlso pagedatasource.Tables.Count > 0 AndAlso pagedatasource .Tables(0).Rows.Count > 0 Then

    For Each row As DataRow In pagedatasource .Tables(0).Rows

    childNode = New Infragistics.Win.UltraWinTree.UltraTreeNode

    childNode.Tag = row.Item("pagecolumnname").ToString()

    childNode.Text = row.Item("pagecolumnname").Trim.ToString()

    wfNode.Nodes.Add(childNode)

    Next

    End If

    Next

     

    Hope it helps.

    Best

    S.

Children