if (!Page.IsPostBack) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Name", typeof(string))); string serverPath = Server.MapPath("File"); DirectoryInfo dir = new DirectoryInfo(serverPath); foreach (FileInfo fileName in dir.GetFi les()) { DataRow dr = dt.NewRow(); dr[0] = fileName; dt.Rows.Add(dr); } ListBox1.DataSource = dt; ListBox1.DataTextField = "Name"; ListBox1.DataValueField = "Name"; ListBox1.DataBind(); } les()) { DataRow dr = dt.NewRow(); dr[0] = fileName; dt.Rows.Add(dr); } ListBox1.DataSource = dt; ListBox1.DataTextField = "Name"; ListBox1.DataValueField = "Name"; ListBox1.DataBind(); }