Set the DataSource to a String array of file names
<%@ Page %>
<%@ import Namespace="System.IO" %>
<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
'Set the DataSource to a String array of file names
dgFiles.DataSource = Directory.GetFiles("C:\")
dgFiles.DataBind()
End Sub
</script>
<asp:datalist id="dgFiles" runat="server"
RepeatColumns="2" CellSpacing="5">
<ItemTemplate>
<%# Container.DataItem %>
</ItemTemplate>
</asp:datalist>
Related examples in the same category