Why can disabled node can be unchecked?

3 posts, 0 answers
  1. Ed Staffin
    Ed Staffin avatar
    66 posts
    Member since:
    Nov 2008

    Posted 21 Mar 2011 Link to this post

    Hi, I have a treeview as follows:
    <telerik:RadTreeView ID="tvCC" Runat="server" CheckBoxes="True" 
            Skin="Vista" TriStateCheckBoxes="True" CheckChildNodes="True" BorderStyle="Solid"
            BorderColor="Black" BorderWidth="1"  Height="350px" Width="400px" >

    In the code behind I disable a child node of a root node.
    This prevents the user from checking or unchecking the specific node.
    This is good. However, if I  uncheck or check the parent node the child still get's toggled even though it's disabled.
    Anyway to prevent this client side?
    Thanks ... Ed
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Mar 2011 Link to this post

    Hello Ed,

    You can set the 'Checkable' property of RadTreeView node as false when disabling that particular node which in turn disables to select the CheckBox of the child node.

    RadTreeNode node = tvCC.FindNodeByText("Brisbane");//find the node
    node.Enabled = false;
    node.Checkable = false;

  3. Ed Staffin
    Ed Staffin avatar
    66 posts
    Member since:
    Nov 2008

    Posted 22 Mar 2011 Link to this post

    Hi thanks for the reply, but that doesn't work.
    They still need to be able to click on the parent.

    Here's what I did as a work around. Cludgy, but works.
    function DoOnClientNodeChecked(sender, eventArgs) 

       // basically this function serves to protect disabled nodes.
       // the problem comes in when a parent node of a disabled child node is unchecked.
       // in this case the control unchecks all child nodes even if they are disabled.
       // so, this forces disabled nodes back.
       var oNode;
       var i;
       var oAllNodes = eventArgs.get_node().get_allNodes();
       for (i = 0; i < oAllNodes.length; i++)
           oNode = oAllNodes[i];
           if (!oNode.get_enabled())

    Thanks ... Ed

Back to Top