I am facing diff Problem with Selecting Node.
When i am selecting first node,selecting but when i select the second one previous one remains same and current one is not selecting.
I don't need post back and in Button click i need to get the selectedNode that's it.
I have gone throught the articles but Huge Javascript code is there and I also found Simple Code like.
Treeview_Data.selectedNode.value;
But it's not working For me,Can any one help.
Loading

Suthish NairRank #92 · 22.8K reputationPosted Dec 10, 2010, 4:18 AM EST
function OnCheckBoxCheckChanged(evt) { var src = window.event != window.undefined ? window.event.srcElement : evt.target; var isChkBoxClick = (src.tagName.toLowerCase() == "input" && src.type == "checkbox"); if (isChkBoxClick) { var parentTable = GetParentByTagName("table", src); var nxtSibling = parentTable.nextSibling; if (nxtSibling && nxtSibling.nodeType == 1)//check if nxt sibling is not null & is an element node { if (nxtSibling.tagName.toLowerCase() == "div") //if node has children { //check or uncheck children at all levels CheckUncheckChildren(parentTable.nextSibling, src.checked); } } //check or uncheck parents at all levels CheckUncheckParents(src, src.checked); } }function CheckUncheckChildren(childContainer, check) { var childChkBoxes = childContainer.getElementsByTagName("input"); var childChkBoxCount = childChkBoxes.length; for (var i = 0; i < childChkBoxCount; i++) { childChkBoxes[i].checked = check; } }function CheckUncheckParents(srcChild, check) { var parentDiv = GetParentByTagName("div", srcChild); var parentNodeTable = parentDiv.previousSibling; if (parentNodeTable) { var checkUncheckSwitch; var isAllSiblingsChecked = AreAllSiblingsChecked(srcChild, 1); if (isAllSiblingsChecked) { checkUncheckSwitch = true; }var inpElemsInParentTable = parentNodeTable.getElementsByTagName("input"); if (inpElemsInParentTable.length > 0) { var parentNodeChkBox = inpElemsInParentTable[0]; parentNodeChkBox.checked = checkUncheckSwitch; //do the same recursively //CheckUncheckParents(parentNodeChkBox, checkUncheckSwitch); } } }var sFlag = true; function AreAllSiblingsChecked(chkBox, k) { var j = 0; var parentDiv = GetParentByTagName("div", chkBox); var childCount = parentDiv.childNodes.length; for (var i = 0; i < childCount; i++) { if (parentDiv.childNodes[i].nodeType == 1) //check if the child node is an element node { if (parentDiv.childNodes[i].tagName.toLowerCase() == "table") { var prevChkBox = parentDiv.childNodes[i].getElementsByTagName("input")[0]; //if any of sibling nodes are not checked, return false if (k == 1) { if (prevChkBox.checked) { sFlag = true; } else { if (sFlag == true) { sFlag = true; } else { sFlag = false; } } } if (k == 2) { if (prevChkBox.checked) { sFlag = true; break; } else { sFlag = false; } } } } } return sFlag; }//utility function to get the container of an element by tagname function GetParentByTagName(parentTagName, childElementObj) { var parent = childElementObj.parentNode; while (parent.tagName.toLowerCase() != parentTagName.toLowerCase()) { parent = parent.parentNode; } return parent; }protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TreeView1.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)"); } }lakshmi prasanna15 reputationPosted Dec 12, 2010, 7:16 PM EST
Suthish NairRank #92 · 22.8K reputationPosted Dec 12, 2010, 8:12 PM EST
Can you explain this statement, how you came to know the focus of nodes.
This is working example with Checkboxes
Then wait for more answers, someone will help you.
Remember to provide all informations in your thread next time.