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
>
查看全文
相关阅读:
更新的OPENCV资料
单通道图像的直方图(C/C++源代码)
Java2下Applet数字签名具体实现方法
采用HVS的图像相似度准则计算WPSNR
彩色图像分割的FLOOD FILL方法(源代码)
数字图像的直方图均衡化(C/C++源代码)
彩色图像分割的FLOOD FILL方法(源代码)
14、C++ Primer 4th 笔记,迭代器
16、C++ Primer 4th 笔记,static(静态)类成员
12、C++ Primer 4th 笔记,关联容器(2)
原文地址:https://www.cnblogs.com/goodspeed/p/35854.html
最新文章
在Sandy Bridge上安装Snow Leopard
2011年中的Mono
A+B for InputOutput Practice (II)
A+B for InputOutput Practice (V)
linux时间相关结构体和函数整理
A+B for InputOutput Practice (IV)
C++小结(1)
A+B for InputOutput Practice (III)
A+B for InputOutput Practice (I)
输入某年某月某日,判断这一天是这一年的第几天
热门文章
多核环境下cache line的测试
cctype
详解数字签名
OPENCV 1.0 RC1 版本安装时的编译错误修正
OPENCV 1.0 RC1 版本介绍
ZIGZAG扫描的MATLAB实现
详解数字签名
签名与盖章之新课题-论电子签章之法律效力(转载)
数字图像的直方图均衡化(C/C++源代码)
图像处理网络资源( 转载)
Copyright © 2011-2022 走看看