<%@ 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”>
<%@ 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>
asp.net 2.0 treeview 无限级无刷新示例_asp.net技巧
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » asp.net 2.0 treeview 无限级无刷新示例_asp.net技巧
相关推荐
-      对.net framework 反射的反思_asp.net技巧
-      .net3.5和vs2008中的asp.net ajax_asp.net技巧
-      使用asp.net ajax框架扩展html map控件_asp.net技巧
-      asp.net应用程序资源访问安全模型_asp.net技巧
-      photoshop初学者轻松绘制螺旋漩涡特效_photoshop教程
-      photoshop通道结合图层模式抠狗尾巴草_photoshop教程
-      web.config详解+asp.net优化_asp.net技巧
-      asp.net中多彩下拉框的实现_asp.net技巧