1
클라이언트 측 ASP.NET Treeview에서 선택한 노드의 깊이를 알아야합니다.ASP.NET : ASP.NET 트리 뷰에서 클라이언트 측 JavaScript로 선택된 노드 가져 오기
어쨌든 이것을 알고 있습니까?
감사합니다.
클라이언트 측 ASP.NET Treeview에서 선택한 노드의 깊이를 알아야합니다.ASP.NET : ASP.NET 트리 뷰에서 클라이언트 측 JavaScript로 선택된 노드 가져 오기
어쨌든 이것을 알고 있습니까?
감사합니다.
나는 이렇게하고 싶지 않다. 시간이 허락한다면 나는 다른 방법을 시도 할 것이다.
var id = TreeView2_Data.selectedNodeID.value; //Get the Selectednode id of tv with asp.net id of TreeView2
if (id.length > 0) {
var selectedNode = document.getElementById(id); //Get the Selectnode object -> selectedNode.innerText will give you the text of the node
if ((typeof (selectedNode) != "undefined") && (selectedNode != null)) {
//Determine the depth of the select node
var nodeDepth = selectedNode.host.split('\\\\').length // the separator is the default single \. Tv adds the extra on and of course we have to add 2 for the string literals.
//node depth wil always be one more than the real node depth, so root is one.
if (nodeDepth >= 4) {
//Do stuff or return value
}
}
}
희망이 있습니다. 대안을 찾으면 다시 게시하십시오.