在asp.net中的iframe中查看Treeview的选定节点包含 [英] see selected node containts of treeview in iframe in asp.net
本文介绍了在asp.net中的iframe中查看Treeview的选定节点包含的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的项目中创建welbifemanager,并且我将树视图与文件系统绑定,但是我也想在iframe中显示树视图的选定节点的容器...是否有任何代码可以做到这一点???提前感谢...
I want to create welbifemanager in my project, and i hv binded my treeview with filesystem but i also want to display containts of selected node of treeview in iframe... is there any code to do this??? Thanx in advance...
'''I m posting my treeview code here to understand properly...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'On the first page visit, populate the photo tree and select the root node
If Not Page.IsPostBack Then
PopulateTree()
PictureTree.Nodes(0).Select()
End If
End Sub
Private Const VirtualImageRoot = "~/"
Private Sub PopulateTree()
'Populate the tree based on the subfolders of the specified VirtualImageRoot
Dim rootFolder As New DirectoryInfo(Server.MapPath(VirtualImageRoot))
Dim root As TreeNode = AddNodeAndDescendents(rootFolder, Nothing)
'Add the root to the TreeView
PictureTree.Nodes.Add(root)
End Sub
Private Function AddNodeAndDescendents(ByVal folder As DirectoryInfo, ByVal parentNode As TreeNode) As TreeNode
'Add the TreeNode, displaying the folder's name and storing the full path to the folder as the value...
Dim virtualFolderPath As String
If parentNode Is Nothing Then
virtualFolderPath = VirtualImageRoot
Else
virtualFolderPath = parentNode.Value & folder.Name & "/"
End If
Dim node As New TreeNode(folder.Name, virtualFolderPath)
'Recurse through this folder's subfolders
Dim subFolders As DirectoryInfo() = folder.GetDirectories()
For Each subFolder As DirectoryInfo In subFolders
Dim child As TreeNode = AddNodeAndDescendents(subFolder, node)
node.ChildNodes.Add(child)
Next
Return node 'Return the new TreeNode End Function
推荐答案
下面的Java脚本代码可以获取所选节点的内容.
Below java script code can fetch the content of the selected node.
<script language="javascript" type="text/javascript">
function showTreeNodeContent() {
var tree = document.getElementById('<%=TreeView1.ClientID %>');
var nodes = tree.getElementsByTagName('a');
for (var n = 0; n < nodes.length; n++) {
var getContent = nodes[n].getAttribute('myattr');
}
}
}
</script>
这篇关于在asp.net中的iframe中查看Treeview的选定节点包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文