Customizing the radtreeview tristate behavior

4 posts, 0 answers
  1. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 13 Feb 2012 Link to this post

    Is it possible to customize the radtreeview tristate behaviour in case of checkboxes. My requirement is to keep the tristate behavior, but i do not want the child nodes to be checked on checking of the parent node. Following are my settings,

    <telerik:RadTreeView OnClientNodeChecking="ClientNodeChecking" Height="100%" ID="RadTreeView2" runat="server" CheckBoxes="True"
                                    TriStateCheckBoxes="true" CheckChildNodes="False">

    But this does not work as expected. Is this some known limitation or am I missing something?
  2. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 13 Feb 2012 Link to this post

    It looks like TriStateCheckBoxes="true" CheckChildNodes="False" this combination does not have any effect, that is with this configuration the child nodes still get checked on check of parent node. Can you please confirm this behavior ?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 14 Feb 2012 Link to this post

    Hello Mirang,

    Yes, when you enable TriStateCheckBoxes, the CheckChildNodes feature is automatically turned on, regardless of what you set the CheckChildNodes property to. This is needed in order to keep the treeview nodes consistent with the TriState behavior, when you check a node. Consider the following scenario, where have a tree like the following one:
    <telerik:RadTreeView TriStateCheckBoxes="true" CheckBoxes="true" ID="RadTreeView1" runat="server">
        <Nodes>
            <telerik:RadTreeNode Expanded="true" Text="Root">
                <Nodes>
                    <telerik:RadTreeNode Expanded="true" Text="Child 1">
                        <Nodes>
                            <telerik:RadTreeNode Text="GrandChild 1" />
                        </Nodes>
                    </telerik:RadTreeNode>
                </Nodes>
            </telerik:RadTreeNode>
        </Nodes>
    </telerik:RadTreeView>

    Now you click on the checkbox next to the "Child 1" node. If you don't have CheckChildNodes, "GrandChild 1" will remain unchecked. And now these two nodes are no longer in a tri-state checkboxes relationship, because the parent's checked state is different than the calculated checked state of his children, which breaks the consistency of the tree.
     
    Regards,
    Bozhidar
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  5. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 14 Feb 2012 Link to this post

    Thanks a Lot for your reply.
Back to Top