using System.IO;protected void Page_Load(object sender, EventArgs e){if (!IsPostBack) { BindFileName(); }} public void BindFileName() { DropDownList1.Items.Clear(); string path = Server.MapPath("你的文件夹的路径"); DirectoryInfo di = new DirectoryInfo(path); foreach (FileInfo fi in di.GetFiles()) { ListItem li = new ListItem(); li.Value = fi.FullName; li.Text = fi.Name; DropDownList1.Items.Add(li); } }//把文件夹里的文件名绑定到DropDownList1protected void Button3_Click(object sender, EventArgs e) {//这里是删除按钮 File.Delete(DropDownList1.SelectedValue); BindFileName(); Response.Write(""); }