Context Aware RadTreeView RadTreeViewContextMenu

2 posts, 0 answers
  1. Zed
    Zed avatar
    74 posts
    Member since:
    Apr 2008

    Posted 16 Oct 2013 Link to this post

    Hello,
       Depending on what node the user clicks, I would like to disable/hide a certain RadMenuItem. 
    I found this
    http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/contextmenu/defaultcs.aspx
    but need to find out if a node has siblings.

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

    Posted 17 Oct 2013 Link to this post

    Hi Zed,

    Please try the following code snippet that I tried to access the siblings node of a RadTreeView node on OnClientNodeClicked event.

    ASPX:
    <telerik:RadTreeView ID="RadTreeView" runat="server" OnClientNodeClicked="OnClientNodeClicked1">
        <Nodes>
            <telerik:RadTreeNode Text="First" runat="server">
            </telerik:RadTreeNode>
            <telerik:RadTreeNode Text="Second" runat="server">
            </telerik:RadTreeNode>
            <telerik:RadTreeNode Text="Third" runat="server">
            </telerik:RadTreeNode>
        </Nodes>
    </telerik:RadTreeView>

    JavaScript:
    <script type="text/javascript">
        function OnClientNodeClicked1(sender, args) {
            if (args.get_node().get_isLast() == false)
                alert("Next :" + args.get_node().get_nextSibling().get_text());
            if (args.get_node().get_isFirst() == false)
                alert("Previous :" + args.get_node().get_previousSibling().get_text());
        }
    </script>
     
    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top