2015-08-26 4 views
0

У меня есть TreeList с List(Of LedgerAccountEntry)().DevExpress TreeList не отображает дочерние узлы и отображается как корневые узлы вместо

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 

Это только соответствующие части. Пожалуйста, дайте мне знать, если вам нужна дополнительная информация.

В результате получается плоское дерево без дочерних узлов, я проверил, что идентификаторы существуют и вернутся правильно.

ответ

1

Это потому, что вы используете ParentLedgerAccountSys как поле. Вам необходимо конвертировать ParentLedgerAccountSys в собственность или добавить еще одну недвижимость, которая представляет ваше поле ParentLedgerAccountSys.
Вот пример:

Public Class LedgerAccountEntry 
    Public Property LedgerAccountSys As Integer 
    'Public ParentLedgerAccountSys As Integer <-- Here is field. 
    Public Property ParentLedgerAccountSys As Integer '<-- Here is property instead of field. 
    ' 
    ' 
    ' ETC 
End Class 
+0

Wow, что на самом деле работал, спасибо миллион! –