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

Getting Parent Node Text of RadTreeView in OnClientContextMenuItemClicked

3 Answers 257 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brendan
Top achievements
Rank 1
Brendan asked on 29 Apr 2010, 04:41 PM
function RadTreeView_OnClientContextMenuItemClicked(sender, args) {  
 
               var node = args.get_node();  
               var menuItem = args.get_menuItem();  
                 
               if (node.get_level() != 0) {     
                var parentNode = node.get_parent();            
            
               switch (menuItem.get_value()) {        
                     
                   case "Edit":  
                       {  
                           window.radopen("EditFormCS.aspx?ProgName=" + node.get_text() + "&MgrName=" + parentNode.get_text(), "UserListDialog");  
                           break;  
                       }  
                   case "Manager":  
                       {  
                           window.radopen("AddManagerCS.aspx", "UserListDialog");  
                           break;   
                       }  
                   case "Program":  
                       {  
                           window.radopen("AddProgramCS.aspx?Name=" + node.get_text(), "UserListDialog");  
                           break;  
                       }  
                   case "Delete":  
                       {  
                           window.radopen("DeleteFormCS.aspx?ProgName=" + node.get_text(), "UserListDialog");  
                           break;  
                       }  
                   default: break;  
               }  
               }  
 
           }           

I need to get parent node text to pass it as a variable in my contextmenu items. Could you please tell me how to get this kind of functionality.

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 03 May 2010, 08:51 AM
Hello Brendan,

The code you use is correct :

var parentNode = node.get_parent();
var text = parentNode.get_text();

With this you can get the text of the parent of the current node for which contextMenuItem is clicked.
 
Could you explain in detail what are you trying to achieve?

All the best,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
amit
Top achievements
Rank 1
answered on 28 Oct 2011, 04:20 PM
How can I set Parent Node value ???

Amit
0
Princy
Top achievements
Rank 2
answered on 29 Oct 2011, 04:50 AM
Hello Amit,

You can try the following javascript.

JS:
<script type="text/javascript">
function OnClientNodeClicked(sender, args)
{
   if (args.get_node().get_level() != 0)
 {
   args.get_node().get_parent().set_value("3");
   alert(args.get_node().get_parent().get_value());
 }
}
</script>

Thanks,
Princy.
Tags
General Discussions
Asked by
Brendan
Top achievements
Rank 1
Answers by
Veronica
Telerik team
amit
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or