Parent or Child?

5 posts, 0 answers
  1. David
    David avatar
    6 posts
    Member since:
    Aug 2014

    Posted 13 Aug 2015 Link to this post

    I have a raddropdowntree that i'm using to display a list of location with the floors in each location. The user can click on either the location or the floor and submit the form. Some locations either don't have floors or we don't know what floors exist so we have to allow for just the location but if we do have the floors identified, we want to be able to select those too. The floors and locations come from two different database tables, each with their own IDs. The ID of a floor might be the same as the ID of a location in the database. Is there any way to know if I've selected a parent or a child in the raddropdowntree? If it's a parent, it's a location but if it's a child, it's a floor (always). How would I determine what level the selected item is at?
  2. David
    David avatar
    6 posts
    Member since:
    Aug 2014

    Posted 13 Aug 2015 Link to this post

    Looking through some of the other forum posts here as well, I thought I'd add something to my original post. Because the floor may or may not exist, I can't simply look for whether the selected item has children or not because some locations might not have any children. All locations would always be at level "0" of the tree while all floors would always be at level "1" of the tree but that's the only hard and fast rule that I can state. I have to be able to know if the selected item is at level "0" or "1". Thoughts?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 17 Aug 2015 Link to this post

    Hi,

    You can use the OnClientEntryAdding event of RadDropDownTree as for example in the code below:
    function OnClientEntryAdding(sender, args) {
        alert(args.get_node().get_level());
    }

    Hope this will help you solve the issue.


    Regards,
    Plamen
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. David
    David avatar
    6 posts
    Member since:
    Aug 2014

    Posted 17 Aug 2015 Link to this post

    Isn't there a way to do it in the code behind instead of javascript?
  6. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 19 Aug 2015 Link to this post

    Hello,

    There is not such similar method in the server so so once possible way to use it there is to use AjaxRequest.

    Regards,
    Plamen
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017