2

我需要在 Web 用户控件(.NET 4.0、C#、Web 窗体)中创建一个下拉列表。

此列表应该是 MyPages 文件夹中的 .aspx 列表,进入我的 Web 应用程序。

我怎样才能创建它?我需要阅读文件夹->文件还是有更好的方法?

4

1 回答 1

8

像这样的东西应该工作:

DirectoryInfo directoryInfo = new DirectoryInfo(Server.MapPath("/MyPages"));
FileInfo[] fileinfo = directoryInfo.GetFiles("*.aspx");

// do data binding here
于 2012-04-08T11:43:33.523 回答