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

TriStateCheckBoxes and Multiple Levels

5 Answers 104 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 01 Dec 2011, 05:03 PM
I have a RadTreeView with checkboxes that could be more than 3 levels deep and we have TriStateCheckBoxes=true.  This works just fine when the second level nodes are selected.  The first level is set to be indeterminate.  If any nodes selected deeper are selected then everything above becomes checked except the first level node.  We'd like the deeper nodes to work the same as the first level node.

The code for the RadTreeView is:
<telerik:RadTreeView ID="tvMultiCountries" runat="server" Skin="Office2009" AllowNodeEditing="false"
    CheckBoxes="true" MultipleSelect="false" CollapseAnimation-Type="OutQuint" EnableEmbeddedSkins="false"
    TriStateCheckBoxes="true" CheckChildNodes="true" OnClientNodeChecked="LocatorGridEntityGeographicUnitSelected">
</telerik:RadTreeView>

On the server side the only manipulation being done (outside of DataBind()), is expanding the first node:

tvMultiCountries.Nodes[0].Expanded = true;


5 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 02 Dec 2011, 10:12 AM
Hello Jon,

I wasn't able to reproduce your probelm, based on the declaration of the treeview alone.
Could you provide the whole page where you use the control, or at least the code for the LocatorGridEntityGeographicUnitSelected function  and also the way you are binding the data, so that we can test it locally. 

Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Jon
Top achievements
Rank 1
answered on 02 Dec 2011, 02:09 PM
The function won't give you anything, we are just using that to build a string of selected values.  Here is the code we use to bind the data:

DataTable dtGeographicUnit = sql.ExecuteDataTable(SpNames.GetGeographicUnits, CommandType.StoredProcedure, new Dictionary<String, String>(){
    {SpParameter.Tenant_RecordID, Convert.ToString(UserContext.TenantId)},
    {SpParameter.Language_RecordID, Convert.ToString(UserContext.Language_RecordID)},
    {SpParameter.Country_RecordID, Convert.ToString(geoRecordId)}});
 
tvMultiCountries.DataSource = dtGeographicUnit;
tvMultiCountries.DataTextField = "Name";
tvMultiCountries.DataValueField = "RecordID";
tvMultiCountries.DataFieldID = "RecordID";
tvMultiCountries.DataFieldParentID = "ParentRecordID";
tvMultiCountries.DataBind();

The data will look this:

Parent_RecordID                         RecordID                                Name
NULL                                    8AF488EB-F7E1-409A-B18A-3E0EDC8A4643    Spain
8AF488EB-F7E1-409A-B18A-3E0EDC8A4643    F3C41DDE-1EA5-417E-8D6F-4000D205ED70    Barcelona
F3C41DDE-1EA5-417E-8D6F-4000D205ED70    A62037AF-1A8B-4D0E-98AB-6F50FD93B2D1    Town in Barcelona

As you can see Spain is first level, Barcelona would be second level (parent_recordid = spain) and Town in Barcelona is third level.
0
Bozhidar
Telerik team
answered on 02 Dec 2011, 06:24 PM
Hello Jon,

I still can't seem to see where the problem is. I've attached a sample project with a database similar to yours, and the TreeView set-up exactly as yours, and it is working fine. Could you run it on your end and tell me if the problem still occurs. And if it doesn't, can you specify the differences between your project and the one I sent you. Also, a picture of the problem would be helpful.

All the best,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Jon
Top achievements
Rank 1
answered on 02 Dec 2011, 06:58 PM
Your sample project is better but still not working I don't think.  In the attached image I clicked on GrandGrandChild1 and would expect Child2 and GrandChild1 to not be checked but instead to be indeterminate.
0
Bozhidar
Telerik team
answered on 05 Dec 2011, 11:37 AM
Hello Jon,

The image you sent me shows the treeview working as it should. Please read how the Tri-State CheckBoxes mechanism works here
In short, when a node has children with different states, only then it's indeterminate. When there is only one child (like the case with GrandChild1 and GrandGrandChild1), when you check this child, the parent will inherit that state, because it doesn't have any other children with different states.


Best wishes, Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TreeView
Asked by
Jon
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Jon
Top achievements
Rank 1
Share this question
or