Javascript – How to select a TreeNode by Javascript

ajaxasp.netjavascript

I've a TreeView that displays hierarchical data, while I select a TreeNode, I generate a series of links that map the path from selected node till root node

Say:
Root Node –> ChildNode –> SelectedNode

What I need is, while clicking any of these links, select required node in TreeView?

I know that selecting a TreeNode is done through ClientSide using this code:

javascript:__doPostBack(TreeView.ClientID,TreeNodeValuePath) 

and

TreeView_SelectNode(TreeView.ClientID_Data, this,TreeNode.ClientID)

Ex:

    <a style="border-style: none; font-size: 1em;" id="tvMenut1" title="Created On: 1/28/2009 9:50:06 AM" onclick="TreeView_SelectNode(tvMenu_Data, this,'tvMenut1');" href="javascript:__doPostBack('tvMenu','s1\\720,63')" class="tvMenu_0 treenodeParent tvMenu_3">
Etravel2000

My problem is to get TreeNode.ClientID?

Any suggestion? FYI: this page is an AJAX-Enabled page.

Best Answer

TreeNode.ClientID as int the ASP.Net control ClientID?

If so, drop this wherever you're trying to pass it: <%= TreeNode.ClientID %>