CSharp Set Datasource To String Array Of File Names – ADO.Net Database

<%@ 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>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.