javascript:var trnSelected; trnSelected = treeview1.getTreeNode(treeview1.selectedNodeIndex); var text=trnSelected.getAttribute("text")vb.net: Dim trnSelected As TreeNode trnSelected = treeview1.GetNodeFromIndex(treeview1.SelectedNodeIndex) dim text=trnSelected.Text
to: justdoit006(我的心太乱 我这样: Dim trnSelected As New Microsoft.Web.UI.WebControls.TreeNode() trnSelected = tvwGroup.GetNodeFromIndex(tvwGroup.SelectedNodeIndex) If trnSelected.Checked = True Then Me.TextBox1.Text = trnSelected.Text End If 如果选中根结点,则显示“Group” 如果没选中根结点,选中其他子结点的话,则什么也不显示。怎样才能遍历到子结点呢?例如选中,aaa,则显示”aaa“?
Dim trnSelected As TreeNode Dim intNodeCounts As IntegertrnSelected = tvwGroup.GetNodeFromIndex(tvwGroup.SelectedNodeIndex)'得到选择的节点 intNodeCounts = trnSelected.Nodes.Count If intNodeCounts = 0 Then'选择了子节点 ....... Else'选择了父节点 Me.TextBox1.Text = trnSelected.Text end if
Else'选择了父节点 Dim trnNode As TreeNode For i = 0 To intNodeCounts - 1 trnNode = trnSelected.Nodes(i) 此处可以继续判断... next end if
用递归做 Private Sub Cpoint(ByVal CNode As Microsoft.Web.UI.WebControls.TreeNode) Dim cp As Short Dim j As Short cp = CNode.Nodes.Count If cp = 0 and CNode.Text="aaa" Then response.write(CNode.Text) Else For j = 0 To cp - 1 Call Cpoint(CNode.Nodes(j)) Next End If End Sub
trnSelected = treeview1.getTreeNode(treeview1.selectedNodeIndex);
var text=trnSelected.getAttribute("text")vb.net:
Dim trnSelected As TreeNode
trnSelected = treeview1.GetNodeFromIndex(treeview1.SelectedNodeIndex)
dim text=trnSelected.Text
我这样:
Dim trnSelected As New Microsoft.Web.UI.WebControls.TreeNode()
trnSelected = tvwGroup.GetNodeFromIndex(tvwGroup.SelectedNodeIndex)
If trnSelected.Checked = True Then
Me.TextBox1.Text = trnSelected.Text
End If
如果选中根结点,则显示“Group”
如果没选中根结点,选中其他子结点的话,则什么也不显示。怎样才能遍历到子结点呢?例如选中,aaa,则显示”aaa“?
Dim intNodeCounts As IntegertrnSelected = tvwGroup.GetNodeFromIndex(tvwGroup.SelectedNodeIndex)'得到选择的节点
intNodeCounts = trnSelected.Nodes.Count
If intNodeCounts = 0 Then'选择了子节点
.......
Else'选择了父节点
Me.TextBox1.Text = trnSelected.Text
end if
For i = 0 To intNodeCounts - 1
trnNode = trnSelected.Nodes(i)
此处可以继续判断...
next
end if
Private Sub Cpoint(ByVal CNode As Microsoft.Web.UI.WebControls.TreeNode)
Dim cp As Short
Dim j As Short
cp = CNode.Nodes.Count
If cp = 0 and CNode.Text="aaa" Then
response.write(CNode.Text)
Else
For j = 0 To cp - 1
Call Cpoint(CNode.Nodes(j))
Next
End If
End Sub