RadTreeView control OnClientNodeClicked is not working

2 posts, 0 answers
  1. Lakshmi
    Lakshmi avatar
    1 posts
    Member since:
    Oct 2013

    Posted 24 Oct 2013 Link to this post

    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();

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 24 Oct 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top