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

RadTreeView control OnClientNodeClicked is not working

1 Answer 199 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Lakshmi
Top achievements
Rank 1
Lakshmi asked on 24 Oct 2013, 09:02 AM

In RadTreeView control if we click on parent node with out expanding its children then in OnClientNodeChecked event its showing children nodes count as 0.

Code

<Rad:RadTreeView ID="tvwTreeDetails" runat="server" Width="400px"  AfterClientCheck="AfterCheckLookup" OnClientNodeChecked="AfterCheck" OnClientNodeClicked="AfterCheck" OnClientNodeClicking="AfterCheck"
                        OnClientNodeChecking="ClientNodeChecking" MultipleSelect="true" CheckBoxes="true" TriStateCheckBoxes="true" ></Rad:RadTreeView>

function AfterCheck(sender, args) {
    var node = args.get_node();

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Oct 2013, 09:27 AM
Hi Lakshmi,

Please try the following code snippet to get the number of child nodes on OnClientNodeChecked event.

ASPX:
<telerik:RadTreeView ID="tvwTreeDetails" runat="server" Width="400px" OnClientNodeChecked="OnClientNodeChecked1"
    CheckBoxes="true" TriStateCheckBoxes="true" MultipleSelect="true">
    <Nodes>
        <telerik:RadTreeNode Text="Node1" runat="server">
            <Nodes>
                <telerik:RadTreeNode Text="Node1.1" runat="server">
                </telerik:RadTreeNode>
                <telerik:RadTreeNode Text="Node1.2" runat="server">
                </telerik:RadTreeNode>
            </Nodes>
        </telerik:RadTreeNode>
        <telerik:RadTreeNode Text="Node2" runat="server">
            <Nodes>
                <telerik:RadTreeNode Text="Node2.1" runat="server">
                </telerik:RadTreeNode>
                <telerik:RadTreeNode Text="Node2.2" runat="server">
                </telerik:RadTreeNode>
            </Nodes>
        </telerik:RadTreeNode>
    </Nodes>
</telerik:RadTreeView>

JavaScript:
<script type="text/javascript">
    function OnClientNodeChecked1(sender, args) {
        if (args.get_node()._hasChildren() == true)
            alert("Child Node :" + args.get_node()._getChildElements().length);
    }
</script>

Thanks,
Shinu.
Tags
TreeView
Asked by
Lakshmi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or