Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > TreeView > RadTreeView, XML, only want final child nodes to trigger NodeClick event (server side) - help!

Not answered RadTreeView, XML, only want final child nodes to trigger NodeClick event (server side) - help!

Feed from this thread
  • Alex avatar

    Posted on Feb 8, 2012 (permalink)

    I am prototyping a new project where users will navigate a dynamically generated list of hierarchically nested assets (bound to a RadTreeView). I want the users to be able to drill down into the tree to the actual asset item in the list. On clicking the asset item:

    1. I want to reload the page using the ID VALUE (not the text displayed) of the item clicked. This will load all sorts of unique info for that item. I was going to simply use querystring variables so the users can bookmark their searches. I'd like to grab the selected ID, put it in querystring, and reload the page. What's the best practice for having an ID VALUE attached to a node (in XML)? What is the best way to access it in C#?

    2. I also want to persist on refresh what the user clicked, so it the selected item is active (because navigating thousands of items all over again isn't acceptable). We're dealing with a nationwide list of assets.

    3. I DON'T want anything to cause a postback except the final child element in the hierarchy. How do I control what causes postback and what doesn't in a dynamically generated RadTreeView list of items?

    Please provide sample code if you can. NOTE: For the prototype, I've already connected to an XML file using the .LoadContentFile() method. I'm using dummy data to get started.

    Thanks much for your assistance!
    A

    Reply

  • Alex avatar

    Posted on Feb 9, 2012 (permalink)

    I figured out how to do everything for #1 and #2. I'm still stuck on #3. I don't want any of the parent nodes in the tree to allow postback... just the final item in the hierarchy.

    Can anyone please provide some tips on ways to do this?
    A

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Feb 10, 2012 (permalink)

    Hi Alex,

    Could you be a little more specific, as to how exactly are you causing a postback from the TreeNodes? If you are just refering to clicking a node, you can cancel this in the OnClientNodeClicking event. Here's an example:
    function clientNodeClicking(sender, args) {
        var node = args.get_node();
        //check if it is a last node
        if (node.get_nodes().get_count() > 0) {
            args.set_cancel(true);
        }
    }

     
    Kind regards,
    Bozhidar
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • Alex avatar

    Posted on Feb 10, 2012 (permalink)

    I decided to just use the NodeClick server side event. If there is a value for the node, then the app will process data based on the value (an ID). For parent nodes, we don't set any value, just the text.

    I do like the client side approach you provided. I'll check it out!

    Thanks.
    A

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > TreeView > RadTreeView, XML, only want final child nodes to trigger NodeClick event (server side) - help!
Related resources for "RadTreeView, XML, only want final child nodes to trigger NodeClick event (server side) - help!"

ASP.NET TreeView Features  |   Documentation   |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]