Treeview in ASP.Net 2.0...javascript and selected node

G

Guest

Hi there,

Does anyone know how to get the selected node from a ASP.Net 2.0 TreeView in
Javascript? I used to be able to get it in the old webcontrols one, but now
the properties have changed and I can't seem to figure it out.

Thanks,

Wes
 
G

Guest

The TreeView creates an object in Javascript on the client side that's called
[treeview name]_Data
i.e., if the treeview is named tvNavigation, the object's name would be
tvNavigation_Data
This object has a property called selectedNodeID. This property has a ...
property called value that contains the id of the currently selected node. So

var name = tvNavigation_Data.selectedNodeID.value;
var selectedNode =
Document.all?Document.all[name]:Document.getElementById(name);

will get a reference to the currently selected node.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top