Clicking Node + Ctrl to multiple select does not fire NodeClick event

3 posts, 0 answers
  1. nfigueroa
    nfigueroa avatar
    21 posts
    Member since:
    Apr 2010

    Posted 22 Nov 2013 Link to this post

    Hello All

    I am trying to get the event TreeView1_NodeClick to fire.  When I click to select a single node there is no problem, but when I intend to select multiple nodes by clicking and holding ctrl or shift keys the event won't fire!

    Is there any other event similar to achieve this?

    Regards
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Nov 2013 Link to this post

    Hi nfigueroa,

    The RadTreeView NodeClick  will not fire when the  MultipleSelect property is  set to True. If the RadTreeView fires the NodeClick server event on every node click , then the user will not be able to select multiple nodes at once, because after the first click the page will postback. In this case you can use the  client-side events of RadTreeView OnClientNodeClicking and OnClientNodeClicked.

    ASPX:
    <telerik:RadTreeView ID="RadTreeView1" runat="server" MultipleSelect="true" OnClientNodeClicked="OnClientNodeClicked" OnNodeClick="RadTreeView1_NodeClick">
        <Nodes>
            <telerik:RadTreeNode runat="server" Text="Item1">
                <Nodes>
                    <telerik:RadTreeNode runat="server" Text="Item1.1">
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Item1.2">
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Item1.3">
                    </telerik:RadTreeNode>
                </Nodes>
            </telerik:RadTreeNode>
            <telerik:RadTreeNode runat="server" Text="Item2">
                <Nodes>
                    <telerik:RadTreeNode runat="server" Text="Item2.1">
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Item2.2">
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Item2.3">
                    </telerik:RadTreeNode>
                </Nodes>
            </telerik:RadTreeNode>
        </telerik:RadTreeView>

    JavaScript:
    <script type="text/javascript">
        function OnClientNodeClicked(sender, args) {
            alert("fired");
        }
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. nfigueroa
    nfigueroa avatar
    21 posts
    Member since:
    Apr 2010

    Posted 04 Dec 2013 Link to this post

    Princy

    Thanks for the reply, sorry mine took so long.  I have tried what you suggested and worked it out in a solution like following:

    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
            function OnClientNodeClicked(sender, args) {
                tv = $find("<%= TreeView1.ClientID%>");
                nodes = tv.get_selectedNodes();
                if (nodes.length > 1) {
                    ....
                }
            }
        </script>
    </telerik:RadScriptBlock>

    Thanks again for the help!

Back to Top