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

Adding Context Menus dynamically for Childnode while using Load On Demand WebService Method for Populating the Tree Node

4 Answers 234 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Rohit
Top achievements
Rank 1
Rohit asked on 02 Dec 2010, 12:11 PM
Hi,

We are populating the tree using webservie Load On Demand method. In this we able to add child node while expanding the node. But issue is that we are not able to add  Context Menus for every child node dynamically. It means we want to add context menu at the time of node creation in webservice method. We want to this way because on the context menu of every node we want to show two items. First Item of context Menu will be the name of the node and second item would be some constant value.

We able to add context menu at design time but for our requirement we want to add context menu for every node at the time of creation of node so that for each node context menu items text value will be different as in our case name of the node.


Please suggest.

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 03 Dec 2010, 01:19 PM
Hi Rohit,

Unfortunately you cannot add context menus to the nodes in the web service method. You can try to subscribe to OnClientContextMenuShowing event of the treeview and add the items in its handler with javascript.

Greetings,
Yana
the Telerik team
Browse the vast support resources we have to jumpstart 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.
0
Rohit
Top achievements
Rank 1
answered on 18 Dec 2010, 01:13 PM
Hello everyone,
1. I have a radtreeview on aspx page. It is bind through a xml file and has checkboxes enabled.
There is another button on the same page. Now what I want is when the use click on button, all the checked nodes should get unchecked.
Can anyone let me know as to how to go for this.
---------------------------------------------------------------------------------------------------

2. I have bind the radtreeview using  following method
this.RadTreeView1.LoadContentFile("test.xml");
I want to show checkboxes only on parent nodes but not on child nodes.
Can anyone let me kow as to how to go for this.
    Also if this is not correct method to achieve the above functionality then kindly let me know the correct method.



Thanks and Regards
0
Rohit
Top achievements
Rank 1
answered on 21 Dec 2010, 01:44 PM
We have an issue here.
PFA the screen shot of our current scenario.

In "Figure1" we have a tree view "User Hierarchy". This treeview has binded with nodes using serversidecallback load on demand.
 
Now in "Figure2" there is a "search" option on top of the page. On clicking the magnifying icon the "Search Results" grid gets opened up. Now in the grid you can see there is a "<-" arrow sign which on click will search the corresponding node in "User Hierarchy" and display the node by highlighting it in "User Hierarchy" as displayed in "Figure3" and "Figure4".
 
"Figure4" is the actual image("Figure3" is for unserstanding purpose about the hierarchy), as it highlights the node to top of the tree("User Hierarchy").
 
We are trying to implement the same in our demo application.
Can you suggest us as to how to search such node in "User Hierarchy" and highlighting it in the same at the node to top of the tree("User Hierarchy").
 
Since our tree is binded by serversidecallback load on demand, using RadTreeView.GetAllNodes() will not work if I search any child node.
Kindly provide us proper solution to this and let us know if we are not going correct.
 
Awaiting your reply.
 
Thanks and Regards
0
Nikolay Tsenkov
Telerik team
answered on 22 Dec 2010, 12:57 PM
Hello Rohit,

About the first post:
 - I think I have answered this one somewhere else, but just in case I will answer it here, too:
   - About unchecking all nodes - there is a function of RadTreeView's client-side object representation uncheckAllNodes, which you can use;
   - About the checkability of the nodes - there is a property of the RadTreeNode - Checkable which you should set to false (server-side) if you don't want the node to be rendered with a checkbox on the side.

About the node highlighting:
 - You can use this kb article as an example of even more complex type of highlighting (just part of the node's text): http://www.telerik.com/support/kb/aspnet-ajax/treeview/how-to-manage-search-select-all-and-deselect-all-functionality-for-radtreeview-in-radcombobox.aspx


Regards,
Nikolay Tsenkov
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.
Tags
TreeView
Asked by
Rohit
Top achievements
Rank 1
Answers by
Yana
Telerik team
Rohit
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
Share this question
or