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

Tri-State checkboxes server-side settings bug?

1 Answer 60 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
tomas
Top achievements
Rank 1
tomas asked on 14 Oct 2009, 11:38 AM
Hello Telerik!

Some nodes can be checked on the server and there are checked also in the generated control (leaf nodes). Some nodes can be checked on the server programatically, also data for the control contains JSON array: checked:1, but generated treeview does not contain checked nodes. In fact only leaf nodes can be checked on server side when tri-state checkboxes are enabled.

        void treeView_NodeDataBound(object sender, RadTreeNodeEventArgs e)  
        {  
            int i;  
            if (this.keys != null)  
            {  
                for (i = 0; i < this.keys.Length; i++)  
                {  
                    if (keys[i] == e.Node.Value)  
                        break;  
                }  
                if (i < this.keys.Length)  
                {  
 
                    if (this.treeView.CheckBoxes)  
                        e.Node.Checked = true;  
                    else  
                        e.Node.Selected = true;  
                }  
            }  
        } 
<RadTreeView DataTextField="n_code_name" DataFieldID="n_id" DataFieldParentID="att_50170_key" DataValueField="n_id" Skin="Office2007" CheckBoxes="True" TriStateCheckBoxes="true" CheckChildNodes="false" /> 


Thank you Tom

1 Answer, 1 is accepted

Sort by
0
Vesko
Top achievements
Rank 2
answered on 16 Oct 2009, 07:38 AM
Yes, this is expected in TriStateCheckBoxes scenario. The parent node can be checked only if all of the child nodes are checked. Otherwise it should be unchecked or indeterminate.

So, if you want to check the parent - just check all of its children.
Tags
TreeView
Asked by
tomas
Top achievements
Rank 1
Answers by
Vesko
Top achievements
Rank 2
Share this question
or