Hello!
I have the following objects and datastructure that I would like to bind to the TreeView and have displayed. The classes and datastructure is simplified, but I'm sure you'll get the idea.
Now, I have a generic list of List<TreeComponent> in which I have some "Folders" and some "Files". The "Folders" also contain "Subfolders" and other "Files". Graphically it looks something like this:
-Folder1 (level1)
- Folder2 (level2
- File1 (level 3)
- File2 (level2)
- Folder3 (level1)
...etc.
So with that datastructure I bind to the TreeView:
...but only "level 1" nodes are displayed. I guess the TreeView does not support lists with childlists. What is the easiest way to display those subfolders and files. It's not an obtion to "flatten" the initial list it has to stay like it is!
Best regards
Claus
I have the following objects and datastructure that I would like to bind to the TreeView and have displayed. The classes and datastructure is simplified, but I'm sure you'll get the idea.
public
class
Folder : TreeComponent
{
public
int
Id {
get
;
set
; }
public
int
ParentId {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
List<TreeComponent> Children {
get
;
set
; }
}
public
class
File : TreeComponent
{
public
int
Id {
get
;
set
; }
public
int
ParentId {
get
;
set
; }
public
string
Name {
get
;
set
; }
}
Now, I have a generic list of List<TreeComponent> in which I have some "Folders" and some "Files". The "Folders" also contain "Subfolders" and other "Files". Graphically it looks something like this:
-Folder1 (level1)
- Folder2 (level2
- File1 (level 3)
- File2 (level2)
- Folder3 (level1)
...etc.
So with that datastructure I bind to the TreeView:
this
.RadTreeViewAreas.DataFieldID =
"Id"
;
this
.RadTreeViewAreas.DataFieldParentID =
"ParentId"
;
this
.RadTreeViewAreas.DataTextField =
"Name"
;
this
.RadTreeViewAreas.DataSource =
this
.treeComponentList
this
.RadTreeViewAreas.DataBind();
...but only "level 1" nodes are displayed. I guess the TreeView does not support lists with childlists. What is the easiest way to display those subfolders and files. It's not an obtion to "flatten" the initial list it has to stay like it is!
Best regards
Claus