Get the value of the node clicked in treeview

2 posts, 1 answers
  1. James
    James avatar
    8 posts
    Member since:
    Nov 2010

    Posted 03 Feb 2011 Link to this post

    I have been using the RadFileExplorer and have been getting on great with it, its a fantastic control. One thing I'm trying to do is add a lot of custom menu items. I have followed code examples on here to achieve this and it all all appears to work well apart from the menu in the tree view. if i right click an item the code uses the node currently selected, not the node i clicked, therefore I have to click the node I want before right clicking it again for the context menu to achieve the results I want, I've looked through the Documentation available online for both the file explorer and tree view but cannot see the client side code to achieve what I want, below is the client side code I currently use, any solution would be greatly appreciated!

    function treeContextMenuClicked(toolbar, args) {
            var buttonValue = args.get_menuItem().get_value();
            var fileExplorer = $find("<% = rfeFilesAndFolders.ClientID %>");
            var treeView = fileExplorer.get_tree();
            var fID = treeView.get_selectedNode().get_attributes().getAttribute("FolderId");
            var fType = treeView.get_selectedNode().get_attributes().getAttribute("FolderType");
            var msg = fID + " " + fType
            var isSilverlight = 1;
            if (buttonValue == "share" && fType == 2) {
                var sURL = '<%=session("webbase") %>Share/' + fID + '/Add'
                var owindow = radopen(sURL, null);
                owindow.SetTitle('Share Object');
                owindow.SetSize(530, 360);
                return false;
  2. Answer
    Dobromir avatar
    1633 posts

    Posted 04 Feb 2011 Link to this post

    Hi James,

    In order to get reference to the node that has called the context menu, you need to use the arguments object, e.g.:
    function OnClientContextMenuItemClicked(sender, args)
        var node = args.get_node();

    All the best,
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top