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

Parent or Child?

4 Answers 29 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 13 Aug 2015, 09:15 PM
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?

4 Answers, 1 is accepted

Sort by
0
Bill
Top achievements
Rank 1
answered on 13 Aug 2015, 09:19 PM
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?
0
Plamen
Telerik team
answered on 17 Aug 2015, 09:05 AM
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
0
Bill
Top achievements
Rank 1
answered on 17 Aug 2015, 12:41 PM
Isn't there a way to do it in the code behind instead of javascript?
0
Plamen
Telerik team
answered on 19 Aug 2015, 01:31 PM
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
Tags
DropDownTree
Asked by
Bill
Top achievements
Rank 1
Answers by
Bill
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or