Hi collegues,
I would like to bind my inherited TreeView to a custom object list.
It should automatically make the nodes based on parent-child relationships.
But at the databind (line 10.) I get a runtime error "Object of type TreeViewItem does not have a ParentId property.".
Which is a lie, as you can see :)
When i comment line 7. It also happens with the other properties(DataTextField and DataNavigateUrlField), but this is the first to run into.
Do you have any idea what is going wrong here?
Kind regards,
Bob Gladon
01.
public
class
NavigateTreeView : RadTreeView
02.
{
03.
protected
void
NavigateTreeView_Load(
object
sender, EventArgs e)
04.
{
05.
this
.DataTextField =
"Name"
;
06.
this
.DataFieldID =
"ItemId"
;
07.
this
.DataFieldParentID =
"ParentId"
;
08.
this
.DataNavigateUrlField =
"UrlPath"
;
09.
this
.DataSource = GetTreeViewItems();
10.
DataBind();
11.
}
12.
13.
private
List<TreeViewItems> GetTreeViewItems()
14.
{
15.
//Some implementation
16.
}
17.
}
18.
19.
public
class
TreeViewItem
20.
{
21.
public
TreeViewItemType Type;
22.
public
int
ParentId;
23.
public
int
? ItemId;
24.
public
string
Name;
25.
public
string
UrlPath;
26.
}