Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1370
Click on a WebDataMenu Item and get WebDataTree Node Value
posted

Hi all,


I'm trying to build a file explorer with WebDataTree and WebDataMenu.

The menu has a item with "open file", I'd like to get the value of the Selected node from WebDataTree and retrieve this value on server side.

My goal is to open the selected file on clicking on the Open File menu item.

 

Thank you 

  • 3726
    Suggested Answer
    posted

    Hi,

    the WebDataTree has server side property  SelectedNodes. On the client side using javascript  you could retrieve the selected nodes using tree.get_selectedNodes() which is an array of selected node objects.

    You can store the file url in the .Value server side property of the Node object so that later you can use it to open the file on the serverside.

    So I would do it to configure the web data menu autopostback flags on ItemClick to be On. When the user clicks on the Open file item. The page will postback and on the serverside you could access the WebDataTree.SelectedNodes in the ItemClick handler that you attached to the menu ItemClick serverside event. Then you can use the .Value filed of the Node object and open the file from the location.

    Hope this helps.

    Thanks,

    Lubomir