Unable to bind checked nodes in Radtreeview

7 posts, 1 answers
  1. pavan
    pavan avatar
    17 posts
    Member since:
    Aug 2010

    Posted 08 Dec 2010 Link to this post


    I have a RadGrid that uses a GridTemplate column along with two Gridbutton columns called Edit and Delete .When I click on Edit to edit a particular record,  all my textboxes and combo boxes get filled from the grid column as these fields are also visible as the grid columns.In Edit panel ,we have also one treeview with checkboxes, which should populate with some checkboxes as checked  depending on the dataset. Here our problem started.We are not able to set checkboxes as checked.While dubugging, I observed that it is making the nodes as checked depending on dataset data but still it is not showing in the page.  




    void radTreeview_Load(object sender, EventArgs e)




    RadTreeView radSelectPartner;
      radSelectPartner = (
      if (radSelectPartnerNodes.Count == 0)
        DataSet dtatable = (DataSet)Session["SelectPartner"];
        radSelectPartner.DataTextField =
    "Partner Name";
        radSelectPartner.DataValueField =
        radSelectPartner.DataFieldID =
        radSelectPartner.DataFieldParentID =
        radSelectPartner.DataSource = dtatable;
          if (ViewState["ContactEmail"] != null)
         DataSet dsSelectParners = chkitems(ContactEmail);
         for (int count = 0; count < dsSelectParners.Tables[0].Rows.Count; count++)
         if (dsSelectParners.Tables[0].Rows[count][0].ToString() != null)
                foreach (RadTreeNode radNode in radSelectPartner.GetAllNodes())
                    radNode.Checkable =
                     // for checking only child node.Currently RadTreeView depth is 2.
                     if (radNode.Level != 0 && radNode.Level != 1)
                             if (radNode.Value.ToString() == dsSelectParners.Tables[0].Rows[count][1].ToString())
                                    radNode.Checked =


  2. Answer
    Nikolay Tsenkov
    Nikolay Tsenkov avatar
    734 posts

    Posted 14 Dec 2010 Link to this post

    Hi pavan,

    Here is example, that should show you, how to bind the TreeView correctly:
    1. markup:
    Copy Code
    <telerik:RadTreeView runat="server" ID="RadTreeView1">
    2. Code-behind:
    Copy Code
    protected void Page_Load(object sender, EventArgs e)
        DataTable dataTable = new DataTable();
        dataTable.Rows.Add(new String[] { "root node1", "1", null, "false" });
        dataTable.Rows.Add(new String[] { "root node2", "2", null, "false" });
        dataTable.Rows.Add(new String[] { "root node3", "3", null, "false" });
        dataTable.Rows.Add(new String[] { "root node4", "4", null, "false" });
        dataTable.Rows.Add(new String[] { "root node5", "5", null, "false" });
        dataTable.Rows.Add(new String[] { "root node6", "6", null, "false" });
        dataTable.Rows.Add(new String[] { "node11", "7", "1", "false" });
        dataTable.Rows.Add(new String[] { "node12", "8", "1", "true" });
        dataTable.Rows.Add(new String[] { "node13", "9", "1", "true" });
        dataTable.Rows.Add(new String[] { "node14", "10", "1", "false" });
        dataTable.Rows.Add(new String[] { "node15", "11", "1", "false" });
        dataTable.Rows.Add(new String[] { "node16", "12", "1", "false" });
        dataTable.Rows.Add(new String[] { "node111", "13", "7", "false" });
        dataTable.Rows.Add(new String[] { "node112", "14", "7", "false" });
        dataTable.Rows.Add(new String[] { "node123", "15", "7", "false" });
        RadTreeView1.DataSource = dataTable;
        RadTreeNodeBinding binding = new RadTreeNodeBinding();
        binding.CheckedField = "Checked";
        binding.Checkable = true;
        RadTreeView1.DataFieldParentID = "ParentID";
        RadTreeView1.CheckBoxes = true;
    (I am simulating the dataSource here in order to run the example without having to worry about dependencies).

    Please, use the provided example in order to bind your TreeView and let me know the results.

    Nikolay Tsenkov
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. pavan
    pavan avatar
    17 posts
    Member since:
    Aug 2010

    Posted 15 Dec 2010 Link to this post

    Thanks for the reply...it works
  4. ahmet
    ahmet avatar
    12 posts
    Member since:
    May 2014

    Posted 19 Mar 2015 Link to this post

    i want use this sample but i can't :/

    my code like that
    <telerik:RadTreeView ID="RadTreeViewDevices" runat="server" Width="300px" Height="320px" CheckBoxes="true" DataTextField="NAME" DataValueField="ID" DataFieldID="ID" DataFieldParentID="TCID"><br>                    <DataBindings>
                           <telerik:RadTreeNodeBinding Expanded="True" Checkable="true" CheckedField="Checked"></telerik:RadTreeNodeBinding>                   
     RadTreeViewDevices.DataSource = DeviceList.ToDataTable();

    Data result like the attach file. But result => all treeviews checkboxes unchecked

    I trying different shape but result is the same. What is my  fault?
    Can anyone help me?

  5. ahmet
    ahmet avatar
    12 posts
    Member since:
    May 2014

    Posted 20 Mar 2015 in reply to ahmet Link to this post

    my fault is AJAX, now it works ty.
  6. Dimitar
    Dimitar avatar
    463 posts

    Posted 20 Mar 2015 Link to this post


    Thank you for the follow up. I am glad to know that you have managed to resolve the issue faced.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  7. Brijkumar
    Brijkumar avatar
    2 posts
    Member since:
    Oct 2017

    Posted 19 Jan 2018 in reply to Nikolay Tsenkov Link to this post

    How To Get Checked Value of Node(Child, GrandChild)?
Back to Top