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

RadTreeView and context menu on webservice loaded on demand nodes

6 Answers 148 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 05 Dec 2012, 01:25 PM
Hi,

I have a treeview in which I load the first two levels server side on PageLoad. Children will be loaded using Webservice load on demand and it works well. I have one problem though, when handling the RadTreeView_OnContextMenuClicked event serverside, the e.ClickedNode property is null. So when clicking context menu items, the event fires but when I want to handle the c.clickednode its null. It works with the server side loaded nodes...

What am I missing?

6 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 07 Dec 2012, 03:24 PM
Hello,

Accessing the clicked node in the OnContextMenuClicked server-side event handler could be achieved by using e.Node instead of e.ClickedNode. This might be the reason for returning null value.
Please find attached a sample project that implements the described scenario and let me know if I am missing something.

Kind regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Martin
Top achievements
Rank 1
answered on 07 Dec 2012, 03:42 PM
Hello, sorry for being unclear. I am using e.Node, not SelectedNode. The problem is:

Nodes loaded serverside with ExpandMode=Webservice work with context menus (has e.Node populated)
Nodes actually loaded from Webservice does not work with context menus... (has e.Node = null)
0
Boyan Dimitrov
Telerik team
answered on 11 Dec 2012, 03:59 PM
Hello,

Please find attached sample project that has label control to display the e.Node.Text property by clicking on the context menu. The text property of each node shows whether it was loaded from web service or server side call back. Here you can check a video that shows the behavior at my side. Please try to reproduce your issue using the attached project and let me know if I am missing something.

Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Martin
Top achievements
Rank 1
answered on 11 Dec 2012, 06:30 PM
I think I have located the issue. In the "OnClientNodeClicked" event, i call the node.toggle() method to expand the node on single click. It appears that that is causing the e.node to be null in the contextmenu_clicked event handler.

When removing the node.toggle() from the OnClientNodeClicked event handler, the e.node propery is properly populated in the contextmenuclick event.

Is there a way to solve this?
0
Accepted
Boyan Dimitrov
Telerik team
answered on 14 Dec 2012, 02:36 PM
Hello,

Please find attached a sample project that implements the expanding/collapsing functionality in the OnClientNodeClicked client-side event handler. Please try to modify the project in order to reproduce that issue and let us know if we are missing something. Here you can refer to a video that shows the behavior at my side.

Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Martin
Top achievements
Rank 1
answered on 17 Dec 2012, 07:25 AM
Hello, thank you for your assistance.

I´m sorry for taking up your time for such a simple mistake. 

It appeared I had misconfigured the RadAjaxManager. Since I perform an ajaxrequest in the "OnClientNodeClicked" event and I had not configured the ajaxmanager as an updating control for the radtreeview, the node was null.

Again, sorry.
Tags
TreeView
Asked by
Martin
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Martin
Top achievements
Rank 1
Share this question
or