Dynamically creating tables

B

brian

I have a snipet of code written to search a directory.
With help from the group I figured out how to place all
the files from a direcotory in a single column table
hyperlinked to the file.

The portion of code needed for the iterations is below to
help you understand.

Now I need to take that one step further:
-I want a table
-For each iteration of 'dir' I want the results of 'dir'
to become a column header.
-For each iteration of 'File' I want the results
of 'FIle' to be placed under 'dir' header.
-As this loops through I would like 3 columns in the
table. If more than three iterations of 'dir' occur then
the fourth iteration would go below the first iteration
in column 1.

An example of what I am seeking can be found on my
website: http://www.lbrspec.com/TrussSearchResults.htm

If I could get any help with any part of this project- I
would be greatly appreciated.


Private Sub Main(ByVal Path As String)


Dim dirs() As String = Directory.GetDirectories(Path)
Dim File As String
Dim dir As String

For Each dir In dirs
Dim files() As String = Directory.GetFiles(dir)

For Each File In files
Dim row As New TableRow()
Dim cell As New TableCell()
Dim hyp As New HyperLink()
Dim i As Integer = 1
Dim x As String 'New Literal()
With hyp
.NavigateUrl = File
.Text = "file" & i
.ID() = i
End With

cell.Controls.Add(hyp)
row.Controls.Add(cell)
Table1.Rows.Add(row)
i = i + 1
Next
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top