Using DataGrid to achieve the directory browser
| / * |
Bean products are produced
technical points such as tofu http://www.asp888.net reprint information, please retain the copyright
asp + We all know that can bind the DataGrid to bind ADO to XML, did not think even the directory structure can be bound! Do not believe, will depend on
<% @ Import Namespace = "System.IO"%>
Using the realization of <title> DataGrid Directory Browsing! ! ! </ title>
<script language="C#" runat="server">
void Page_Load (Object Src, EventArgs E) (
ArrayList ar = new ArrayList ();
Directory  dirs = Directory.GetDirectoriesInDirectory (Server.MapPath ("/"));
foreach (Directory dir in dirs) (
foreach (File f in dir.GetFiles ( "*. aspx")) / / If you want to list other types of files, as long as you can change the
dg.DataSource = ar;
<form method="post" runat="server">
Id = "dg"
Runat = "Server"
headerstyle-backcolor = "# 666699"
headerstyle-forecolor = "# FFFFFF"
itemstyle-backcolor = "# EEEEEE"
alternatingitemstyle-backcolor = "# FFFFFF"
alternatingitemstyle-forecolor = "# 000000"
Author: tofu (original)