zoukankan
html css js c++ java
Asp.net 2.0 Treeview 无限级无刷新示例
<%
@ Page Language
=
"
C#
"
%>
<%
@ Import Namespace
=
"
System.IO
"
%>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
>
<
script
runat
="server"
>
void
Treeview1_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
if
(IsCallback)
if
(e.Node.ChildNodes.Count
==
0
)
{
LoadChildNode(e.Node);
}
}
private
void
LoadChildNode(TreeNode node)
{
DirectoryInfo directory;
directory
=
new
DirectoryInfo(node.Value);
foreach (DirectoryInfo sub
in
directory.GetDirectories())
{
TreeNode subNode
=
new
TreeNode(sub.Name);
subNode.Value
=
sub.FullName;
try
{
if
(sub.GetDirectories().Length
>
0
||
sub.GetFiles().Length
>
0
)
{
subNode.SelectAction
=
TreeNodeSelectAction.SelectExpand;
subNode.PopulateOnDemand
=
true
;
subNode.NavigateUrl
=
"
#
"
;
}
}
catch
{ subNode.ImageUrl
=
"
WebResource.axd?a=s&r=TreeView_XP_Explorer_ParentNode.gif&t=632242003305625000
"
; }
node.ChildNodes.Add(subNode);
}
foreach (FileInfo fi
in
directory.GetFiles())
{
TreeNode subNode
=
new
TreeNode(fi.Name);
node.ChildNodes.Add(subNode);
}
}
</
script
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
runat
="server"
>
<
title
>
Untitled Page
</
title
>
</
head
>
<
body
bgcolor
="white"
>
<
form
id
="form1"
runat
="server"
>
<
div
>
<
asp:treeview
ID
="Treeview1"
runat
="server"
ImageSet
="XPFileExplorer"
AutoGenerateDataBindings
="false"
ExpandDepth
=0
OnTreeNodePopulate
="Treeview1_TreeNodePopulate"
>
<
SelectedNodeStyle
BackColor
="#B5B5B5"
></
SelectedNodeStyle
>
<
Nodes
>
<
asp:TreeNode
Value
="C:"
Text
="C:"
PopulateOnDemand
="true"
SelectAction
="Select"
NavigateUrl
="#"
>
</
asp:TreeNode
>
</
Nodes
>
<
NodeStyle
VerticalPadding
="2"
Font-Names
="Tahoma"
Font-Size
="8pt"
HorizontalPadding
="2"
ForeColor
="Black"
></
NodeStyle
>
<
HoverNodeStyle
Font-Underline
="True"
ForeColor
="#6666AA"
></
HoverNodeStyle
>
</
asp:treeview
>
</
div
>
</
form
>
</
body
>
</
html
>
查看全文
相关阅读:
Scrapy框架实现持久化存储
Scrapy框架的介绍和基本使用
处理页面动态加载数据
爬虫数据解析
Python爬虫基础
Flask详解(下篇)
Flask详解(中篇)
CentOS 中的性能监测命令vmstat
CentOS 7安装MySQL 8.0.15
CF B.Kind Anton(4月8号)
原文地址:https://www.cnblogs.com/goodspeed/p/35854.html
最新文章
redis 6.0.9下载安装
Long.getLong("xxx"); 得到空值
springCloud feign @RequestMapping @GetMapping 注意点
git commit的文件在哪?
方法重写的返回值类型
elasticsearch7.6.*(增删改查详细版)
elasticsearch Ik分词器
python 二分法查找字典中指定项第一次出现的索引
Can't pickle local object '_createenviron.<locals>.encodekey'报错解决
报错:selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: missing 'name'
热门文章
Paperask一键获取A币
MySQL Workbench生成E-R图
win10电脑自动连接蓝牙设备攻略
字符串转字典
EPIC限免提示
剪贴板自动翻译
批量获取代理ip
Redis实现分布式爬虫
Scrapy框架高级操作
HTML
Copyright © 2011-2022 走看看