Did you set KeyAspectName
, ParentKeyAspectName
and RootKeyValue
accordingly?
If you did it using the designer, RootKeyValue
may be your problem:
Due to the limitations of the Designer in the IDE, RootKeyValue can only be given a string value through the IDE. If your ParentKey is not of type string, you will have to set its value through code.
Since you parent key is of type int
use
dataTreeListView1.RootKeyValue = 0;
Note that in contrast to the basic OLV, you don't need to add columns manually. If you want to hide the key columns set ShowKeyColumns = false
.
EDIT:
There is another mistake in you code. You add the same instance of the object oClass
3 times. Use oClass = new Class();
before initializing a new person.