I face the following problem : when i try to bind Telerik Treeview
These columns don't currently have unique values.
My code :
protected void BindRTV()
{
rtv_acd.DataTextField = "name";
rtv_acd.DataValueField = "main_id";
rtv_acd.DataFieldID = "main_code";
rtv_acd.DataFieldParentID = "father_code";
rtv_acd.DataSource = dt;
rtv_acd.DataBind();
}
Data snapshot :
How to fix this problem, i know that the main_code
is repetitive but i want that .
There is a parent-child relationship between nodes, and the relation works with values specified in DataFieldID
and DataFieldParentID
members. So you have to specify a field with unique values for DataFieldID
member.
Suppose you have two nodes with ID (main_code
) of 1
(you already have), and there is another node with parent ID (father_code
) of 1
. So which of the two nodes are the parent of this node?