G
Guest
Hi there,
I am trying to use ASP.NET to populate list of files with hyper link from a
specific directory. The following code works well but it populates the list
to the top of the web page. I have header and footer defined on the web
page. How could I write the list to the body session like a specific area, a
table or a list box control?
Thanks in advance.
private void Page_Load(object sender, System.EventArgs e)
{
DirectoryInfo dir = new DirectoryInfo("C:\\temp\\Test");
if (!dir.Exists)
{
throw new DirectoryNotFoundException("The directory does not exist.");
}
// Call the GetFileSystemInfos method.
FileSystemInfo[] infos = dir.GetFileSystemInfos();
foreach (FileSystemInfo i in infos)
{
Response.Write("<A HREF='");
Response.Write (i.Name);
Response.Write ("'>");
Response.Write (i.Name);
Response.Write ("</A><br>");
}
}
I am trying to use ASP.NET to populate list of files with hyper link from a
specific directory. The following code works well but it populates the list
to the top of the web page. I have header and footer defined on the web
page. How could I write the list to the body session like a specific area, a
table or a list box control?
Thanks in advance.
private void Page_Load(object sender, System.EventArgs e)
{
DirectoryInfo dir = new DirectoryInfo("C:\\temp\\Test");
if (!dir.Exists)
{
throw new DirectoryNotFoundException("The directory does not exist.");
}
// Call the GetFileSystemInfos method.
FileSystemInfo[] infos = dir.GetFileSystemInfos();
foreach (FileSystemInfo i in infos)
{
Response.Write("<A HREF='");
Response.Write (i.Name);
Response.Write ("'>");
Response.Write (i.Name);
Response.Write ("</A><br>");
}
}