views:

703

answers:

1

hi i am using a treeview control in my page i am binding the treeview with the datatable

i need to use javascript to get the selected node value on the tree in a button click. how to do this

+1  A: 

When you bind your tree, use the navigateURL property of each node to call a javascript fucntion.

When you bind:

newNode.NavigateUrl = "javascript:clickNode(this, '" + someObject.ID.ToString() + "');

On the client:

var selectedNode;
var selectedValue;

function clickNode(sender, id)
{         

    selectedNode = sender;
    selectedValue = id;

    //do other stuff here       
}
smercer