Completed
Last Updated: 27 Oct 2014 08:34 by ADMIN
francesco
Created on: 09 Apr 2013 19:59
Category: TreeView
Type: Feature Request
2
[radtreeview] databinding
Possibility to bind to a treeview a structure where the Id and the parent id is a Guid instead of a numeric value
1 comment
ADMIN
Bozhidar
Posted on: 27 Oct 2014 08:34
This is already working. This code shows a sample implementation:

<telerik:RadTreeView runat="server" ID="RadTreeView1"
    DataTextField="Text" DataFieldID="ID" DataFieldParentID="ParentID">
</telerik:RadTreeView>


protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        DataTable nodes = new DataTable();

        nodes.Columns.Add(new DataColumn("ID", typeof(Guid)));
        nodes.Columns.Add(new DataColumn("ParentID", typeof(Guid)));
        nodes.Columns.Add(new DataColumn("Text", typeof(string)));

        var parentId = Guid.NewGuid();

        nodes.Rows.Add(parentId, null, "Parent");
        nodes.Rows.Add(Guid.NewGuid(), parentId, "Child");

        RadTreeView1.DataSource = nodes;
        RadTreeView1.DataBind();
    }
}