Hi there, I'm having trouble getting Tri-State checkboxes to work as I assume they should. My TreeView is data bound on the server side to a collection of objects with the following code:
The TreeView itself is declared thusly:
You'll notice that Tri-State Checkboxes is absent from that declaration, I'll get to that shortly...
The NodeDataBound event is where I am setting the checked property of various nodes, the decision of wheather to check a node or not is based on other data that is contained in a member variable of the UserControl that this Tree lives in.
Now, when I leave out the Tri-State Checkboxes from the declaration, the code behaves exactly as I would expect, the nodes that are supposed to be checked are and the ones that are not aren't. What I would prefer however, is to enable the tri-state behavior with the desired result being that the parent nodes of any checked noes will show as "indeterminate" if not all the children are checked and checked if they are so my users will have a cue to where the checked noes are without expanding the entire tree, My problem is that when I set Tri-state checkboes to true, the code executes correctly and sets the checked property of the desired nodes, but in the browser absolutely no nodes are checked or indeterminate.
I'm using version 2010.1.309.20 of the Telerik.Web.UI.dll
Thank You,
Al Irvine
tree.DataTextField =
"Name"
tree.DataValueField =
"NodeID"
tree.DataFieldID =
"NodeID"
tree.DataFieldParentID =
"ParentNodeID"
tree.DataSource = nodes
tree.DataBind()
The TreeView itself is declared thusly:
<
tel:RadTreeView
runat
=
"server"
ID
=
"trvHierarchy"
CheckBoxes
=
"true"
CheckChildNodes
=
"false"
OnNodeDataBound
=
"TreeNodeDataBound"
OnNodeCheck
=
"HierarchyTreeNodeCheck"
></
tel:RadTreeView
>
The NodeDataBound event is where I am setting the checked property of various nodes, the decision of wheather to check a node or not is based on other data that is contained in a member variable of the UserControl that this Tree lives in.
Protected
Sub
TreeNodeDataBound(
ByVal
sender
As
Object
,
ByVal
args
As
RadTreeNodeEventArgs)
If
Not
args.Node
Is
Nothing
Then
Dim
check
As
Boolean
=
False
For
Each
assignedNode
As
KeyValuePair(Of
Integer
,
String
)
In
_assignments
If
assignedNode.Key =
CType
(args.Node.Value,
Integer
)
Then
check =
True
End
If
Next
If
check
Then
args.Node.Checked =
True
Else
args.Node.Checked =
False
End
If
End
If
End
Sub
I'm using version 2010.1.309.20 of the Telerik.Web.UI.dll
Thank You,
Al Irvine