This is a migrated thread and some comments may be shown as answers.

Customizing the radtreeview tristate behavior

3 Answers 89 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
mirang
Top achievements
Rank 1
mirang asked on 13 Feb 2012, 11:34 AM
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?

3 Answers, 1 is accepted

Sort by
0
mirang
Top achievements
Rank 1
answered on 13 Feb 2012, 05:44 PM
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 ?
0
Bozhidar
Telerik team
answered on 14 Feb 2012, 10:07 AM
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 >>
0
mirang
Top achievements
Rank 1
answered on 14 Feb 2012, 11:04 AM
Thanks a Lot for your reply.
Tags
TreeView
Asked by
mirang
Top achievements
Rank 1
Answers by
mirang
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or