Display Checkboxs On Leaf Nodes Only

2 posts, 1 answers
  1. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 26 Nov 2008 Link to this post

    what is the bestway to display checkboxs on leaf nodes only

    is there a property like "showcheckboxes" in the standard treeview control from MS
  2. Answer
    Yana avatar
    4813 posts

    Posted 27 Nov 2008 Link to this post

    Hello Andrew,

    You should set CheckBoxes property to true in order to have checkboxes. The following code snippet demonstrates how to show checkboxes only for leaf nodes:

     protected void checkOnlyLeafNodes(RadTreeNode node)  
            if (node.Nodes.Count != 0)   
                node.Checkable = false;  
                foreach (RadTreeNode node1 in node.Nodes)  

    and you can call it in Page_Load event for every root node:

    foreach (RadTreeNode node in RadTreeView1.Nodes)  

    I hope this helps.

    Kind regards,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top