Load on-demand - Hide checkBox

2 posts, 0 answers
  1. Barbaros Saglamtimur
    Barbaros Saglamtimur avatar
    110 posts
    Member since:
    Jul 2012

    Posted 07 Mar 2011 Link to this post


    I have a radtreeview with load on-demand functionality and works fine.
    What I would like to do is to hide checkbox for nodes which have child nodes count > 0. For root data it works, but not for child nodes.

    Here is my code:

    private static void LoadRootNodes(RadTreeView treeView, TreeNodeExpandMode expandMode)
            foreach (var row in sdps)
                RadTreeNode node = new RadTreeNode
                                           Text = row.FullText,
                                           Value = row.id.ToString(),
                                           ExpandMode = expandMode
                node.Attributes.Add("IdAsText", row.IdAsText);
                if (row.ChildrenCount== 0)
                    node.ExpandMode = TreeNodeExpandMode.ClientSide;
            //This works because RadTreeNode has a Checkable propery
                    node.Checkable = false;
        public static RadTreeNodeData[] LoadSdpTreeView(RadTreeNodeData node)
            List<RadTreeNodeData> result = new List<RadTreeNodeData>();
            foreach (var row in childNodes)
                RadTreeNodeData childNode = new RadTreeNodeData { Text = row.FullText, Value = row.id.ToString() };
                childNode.Attributes.Add("IdAsText", row.IdAsText);
                if (row.ChildrenCount > 0)
                    childNode.ExpandMode = TreeNodeExpandMode.WebService;
            // This doesnt work because there is no Checkable propery for RadTreeNodeData
            // childNode.Checkable = false;
            return result.ToArray();

    How can I achieve this?

    Thanks in advance.
  2. Nikolay Tsenkov
    Nikolay Tsenkov avatar
    734 posts

    Posted 14 Mar 2011 Link to this post

    Hi barbaros saglamtimur,

    You can use the attributes collection in order to send to the client information about the Checkable property of the nodes. Here is a nice article that explains how you can get access to the attributes collection: http://www.telerik.com/help/aspnet-ajax/treeview-attributes-client-side.html

    Nikolay Tsenkov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top