Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

Can i find the full path of the selected node of a asp.net tree view on client side?

I am binding this treeview from dataset and populating a context menu on the treeview. But i want to show the full path(text of all parent nodes separated by some separator) both on node click and on context menu.

Is there any way around?

Please help!!

Regards,
Snigdha
Posted
Comments
Sandeep Mewara 20-Jul-10 3:57am    
Whats the problem in it? You should be able to form the path and append. Whats the issue you are facing while trying it?
ely_bob 20-Jul-10 13:11pm    
Are you trying to do this without post-back?

1 solution

Hi All,

Seems no body is interested in this topic.
Anyway I have got some alternative to do this.

When we bind treeview through XML or dataset, each node is actually rendered as an anchor(a) tag.

So you get a client side function called on "OnContextMenu" or "OnClick" of the treeview and follow this code.

var obj = window.event.srcElement;
var fullpath = obj.href();


Here in fullpath, you can get your fullpath for the selected node, added to some extra information. You can just split it and get the full path. And in my treeview, I am not giving any path for the URL field of the nodes.

In my case, i am splitting it by ','.

Regards,
Snigdha :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900