遍历文件夹里面的文件,并绑定到dropdownlist
string rep_path = Server.MapPath("reports");
string[] files = Directory.GetFiles(rep_path);
string[] report_files = new string[files.Length];
for (int i = 0; i < files.Length; i++)
{
report_files[i] = files[i].Replace(rep_path + "//", "");
}
DropDownList1.DataSource = report_files;
DropDownList1.DataBind();
posted on 2010-02-02 10:32 tongdengquan 阅读(77) 评论(0) 编辑 收藏 举报