C# Tutorials and offshore development in India

Tutorials Resources Forum Reviews Interview Jobs Projects Training Your Ad Here


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...




Resources » Code Snippets » Javascript »

How to get value of selected node in a treeview


Posted Date: 24 Dec 2008    Resource Type: Code Snippets    Category: Javascript
Author: Gitolekha RayMember Level: Gold    
Rating: 1 out of 5Points: 15



One of my colleague was using a treeview. He was not able to get the value of the node selected in a checkbox,the nodes were rendering in a td,say the name of the node is Apple and name of the treeview is tview :-


<td><div style="width:20px;height:1px"></div></td><td><a id="tviewn1" href="javascript:TreeView_ToggleNode(tview_Data,1,tviewn1,' ',tviewn1Nodes)"><img src="/WebResource.axd?d=PdMRdQjqg37GIsWXhYj7raI9LeI5Q965f8gqjMBRo-o1&amp;t=633651122037812682" alt="Expand Apple" style="border-width:0;" /></a></td><td style="white-space:nowrap;"><input type="checkbox" name="tviewn1CheckBox" id="tviewn1CheckBox" /><span class="tview_0" id="tviewt1">Apple</span></td>


The javascript to get the node name in this case will be :-

 
function getSelectedNodeValue()
{
var storeTemp = ''
var x=document.getElementsByTagName("td");

for(var i=0;i {
var srch=x[i].innerHTML;
if(srch.search('CHECKED')>=0)
{
// alert(x[i].innerText);
storeTemp += x[i].innerText + ',';
}
}
storeTemp = storeTemp.substring(0,storeTemp.lastIndexOf(','));
alert(storeTemp);
}



Responses to the resource: "How to get value of selected node in a treeview"

No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Treeview checked node value  .  Selected node in treeview  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: To Calculate Leave Days
Previous Resource: Refresh Page
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
More Resources




About Us    Contact Us    Privacy Policy    Terms Of Use