2012-03-18 104 views
0

我使用visual basic,它是我第一次使用treelist。任何建議如何設置節點在aspxtreelist?aspxtreelist默認情況下如何設置選擇節點(VB)

我想從sql數據庫中設置基於treelist的節點。

模式:

SQL數據庫

| id ---- partnerID |

| 1 ---- 2 |

| 2 ---- 3.2 |

| 3 ---- 4 |

樹形列表

的樹形列表具有值2,2.1,2.2,3,3.1,3.2,4,5

| partnerID --- Command |

| 2 --- + |

| 2.1 --- + |

| 2.2 --- + |

| 3 --- + |

| 3.1 --- |

| 3.2 --- + |

| 4 --- |

| 5 --- |

'+' 作爲節點

當我加載的頁面,我想要的樹形列表有默認選擇節點:2,2.1,2.2,3,3.2

我不知道是什麼屬性必須使用它。

+0

你的問題沒有足夠的幫助你。向我們展示TreeList在標記中的聲明。向我們展示您用來填充它的代碼。你是指http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.aspx? – 2012-03-18 02:37:59

+0

謝謝約翰....我已經解決了我的問題.. :) – tyo 2012-03-19 08:22:19

回答

1

我已經解決了我的問題。這裏我創建的答案:

Dim iterator As TreeListNodeIterator = tree1.CreateNodeIterator() 
    Dim node As TreeListNode 
    Dim foundRow As DataRow 
    Do While Not (_database Is Nothing) 
     node = iterator.GetNext() 
     If node Is Nothing Then 
      Exit Do 
     End If 
     foundRow = _database.Rows.Find(node.Key) 
     If Not (foundRow Is Nothing) Then 
      node.Selected = True 
     End If 

    Loop 

_database是一個數據表,我用它來收集我的數據庫的值。

相關問題