RadTreeView and context menu on webservice loaded on demand nodes

7 posts, 1 answers
  1. Martin
    Martin avatar
    27 posts
    Member since:
    May 2011

    Posted 05 Dec 2012 Link to this post

    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?
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 07 Dec 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Martin
    Martin avatar
    27 posts
    Member since:
    May 2011

    Posted 07 Dec 2012 Link to this post

    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)
  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 11 Dec 2012 Link to this post

    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.
  6. Martin
    Martin avatar
    27 posts
    Member since:
    May 2011

    Posted 11 Dec 2012 Link to this post

    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?
  7. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 14 Dec 2012 Link to this post

    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.
  8. Martin
    Martin avatar
    27 posts
    Member since:
    May 2011

    Posted 17 Dec 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017