I have seen it many times. Programmers just loading data into a label control adding a <br> after each line to make it format properly and calling that databinding.
That isnt how it was meant to be.
For this sort of purpose I like to use a repeater. A repeater is used much like a for… each loop or how we used to while not objrs.eof

There is the repeater tag and the itemtemplate (you also heave header and footer templates and alternating template to play with).

First we add the repeater to our html page:

<asp:Repeater id="Repeater1" runat="server">
	<ItemTemplate>
<a href='<%#databinder.eval(container.dataitem,"filepath") %>' target=_new>
<%#databinder.eval(container.dataitem,"filename")%></a><br>
	</ItemTemplate>
</asp:Repeater>


I added the binding code in there as well which will be used to bind to the datatable I am using in the code behind.

Since my page is rather simple I dont have to worry about submit buttons or anything like that. I just need to declare the datatable, define the columns it will have, and then start adding rows.

I do this in page_load


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim fyl As String
        Dim dt As New System.Data.DataTable
        dt.Columns.Add("filepath")
        dt.Columns.Add("filename")

        Dim dtrow As System.Data.DataRow

        For Each fyl In System.IO.Directory.GetFiles(MapPath("../database/"))
            dtrow = dt.NewRow
            dtrow("filepath") = fyl
            dtrow("filename") = fyl.Substring(fyl.LastIndexOf("\") + 1)
            dt.Rows.Add(dtrow)
        Next fyl

        Repeater1.DataSource = dt
        Repeater1.DataBind()
    End Sub

As you can see I am also using the system.io namespace to let me peek into files in a certain directory.

I then define each column for each file in the directory and add the row to the datatable.
At the end the important thing it to make sure and let the repeater know the datasource as well as call the databind method.

The filename and filepath parameters are the items to keep track of. A mispelling here will cause a runtime error later.

There you go