Bind file information to asp:DataGrid (VB.net) : DataGrid « ASP.net Controls « ASP.NET Tutorial






<%@ Import Namespace="System.IO" %>
<script language="C#" runat="server">
   
   void Page_Load(Object Sender, EventArgs e) {
      DirectoryInfo dir = new DirectoryInfo(Server.MapPath("."));

      DataGrid1.DataSource = dir.GetFiles("*.*");
      DataGrid1.DataBind();
      
   }

</script>

<html><body>
   <b>File information</b><br>
   <asp:DataGrid id="DataGrid1" runat="server" 
      AlternatingItemStyle-Backcolor="#cccccc"
      AutogenerateColumns="true" />
   
</body></html>








3.37.DataGrid
3.37.1.DataGrid Data Binding
3.37.2.Use asp:DataGrid to edit data in an Access table (VB.net)
3.37.3.Use asp:HyperlinkColumn and asp:ButtonColumn in asp:DataGrid (VB.net)
3.37.4.asp:EditCommandColumn in asp:DataGrid (VB.net)
3.37.5.Bind data of directories to asp:DataGrid (VB.net)
3.37.6.Bind file information to asp:DataGrid (VB.net)
3.37.7.Binding DataReader to DataGrid