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
>
查看全文
相关阅读:
卷积神经网路计算公式
Jupyter Notebook
vim batch copy -- copy between row1 and row2 to row3
Intellij 快速复制单行快捷键
Exception in thread "main" java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector
Mac 下查看隐藏文件
Mac 连接 mysql
CC++JavaPython 求字符串长度
LeetCode-1309 Decrypt String from Alphabet to Integer Mapping
❀LeetCode❀-1374. Generate a String With Characters That Have Odd Counts
原文地址:https://www.cnblogs.com/goodspeed/p/35854.html
最新文章
如何计算本年度的每个月有多少天?
生成几个特殊的日期
使用递归算法生成一个序列
成语接龙-成语回环-从自己开始又回到自己
成语接龙-查找指定层数以内的成语
成语接龙-成语归根-从一个成语找到另一个成语
生成1-100之间的数列
查找担保圈-step7-提取未被包含过组的成员,得出结论
查找担保圈-step6-对被包含过的组进行清理,只保留未被包含过的组
查找担保圈-step5-比较各组之间的成员,对组的包含性进行查询,具体见程序的注释-版本2
热门文章
使用Quartz.Net定时发送消息
s0hadowsocks
C# Scoket处理粘包、分包
测试网站连接速度的JS代码
NetCoreAPI添加Swagger
SqlServer中用@@IDENTITY取最新ID不准的问题
获取程序的基目录
Git:SSH、SSH与HTTP区别、git常用命令
AddTransient、AddSingleton、AddScoped的区别
Nginx文章
Copyright © 2011-2022 走看看