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

Context Aware RadTreeView RadTreeViewContextMenu

1 Answer 27 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Zed
Top achievements
Rank 1
Zed asked on 16 Oct 2013, 11:34 AM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 17 Oct 2013, 05:31 AM
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.
Tags
Ajax
Asked by
Zed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or