我有一个
TreeList
从
List(Of LedgerAccountEntry)()
.
Public Class LedgerAccountEntry
Public Property LedgerAccountSys() As Integer
Public ParentLedgerAccountSys As Integer
'
'
' ETC
End Class
形式荷载:
tlLedgerAccounts.ParentFieldName = "ParentLedgerAccountSys"
tlLedgerAccounts.KeyFieldName = "LedgerAccountSys"
tlLedgerAccounts.RootValue = -1
后来:
While bla
entry.LedgerAccountSys = rstAccounts("LedgerAccountSys").Value
entry.ParentLedgerAccountSys = IIf(rstAccounts("ParentLedgerAccountSys").Value Is DBNull.Value, -1, rstAccounts("ParentLedgerAccountSys").Value)
lst.add(entry)
End While
tlLedgerAccounts.DataSource = lst
这些只是相关部分。如果你需要更多信息,请告诉我。
结果是没有子节点的扁平树,我检查了ID是否存在,并且是否正确返回。