%@ Import Namespace="System.IO" %> <%@ Page Language="C#" %> <!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) private void LoadChildNode(TreeNode node) foreach (DirectoryInfo sub in directory.GetDirectories()) try foreach (FileInfo fi in directory.GetFiles()) <html xmlns="http://www.w3.org/1999/xhtml" > <body bgcolor="white">Asp.net 2.0 Treeview 无限级无刷新示例
<%@ Import Namespace="System.IO" %>
{
if (IsCallback)
if (e.Node.ChildNodes.Count == 0)
{
LoadChildNode(e.Node);
}
}
{
DirectoryInfo directory;
directory = new DirectoryInfo(node.Value);
{
TreeNode subNode = new TreeNode(sub.Name);
subNode.Value = sub.FullName;
{
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);
}
{
TreeNode subNode = new TreeNode(fi.Name);
node.ChildNodes.Add(subNode);
}
}
</script>
<head runat="server">
<title>Untitled Page</title>
</head>
<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>
Word教程网
Excel教程网
Dreamweaver教程网
Fireworks教程网
PPT教程网
FLASH教程网
PS教程网
HTML教程网
DIV CSS教程网
FLASH AS教程网
ACCESS教程网
SQL SERVER教程网
C语言教程网
JAVASCRIPT教程网
ASP教程网
ASP.NET教程网
CorelDraw教程网
关于我们 | 教程购买 | 广告刊登 | 网站地图 |湖北继续教育网 |QQ:2693987339(点击联系)购买教程光盘
地址:湖北省武汉市曹家湾32号501室 电话:027-86646545 15972130058--教程购买问题汇总
21视频教程网专业的网站开发视频教程学习网站
ICP备案号:鄂ICP备14009716号-13
公安备案号:42011102002974