Set the DataSource to a String array of file names : DataList « ADO.net Database « ASP.Net






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

1.asp:datalist: repeat column, repeat directions, gridlines,
2.Bind data to asp:datalist
3.Bind data source to asp:DataList
4.DataList data binding with objects
5.datalist and ItemTemplate
6.Bind the Hashtable to the repeater
7.LinkButton in ItemTemplate