c# - 如何创建 .aspx 页面列表?

标签 c# .net drop-down-menu filesystems

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

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

如何创建它?我需要读取文件夹-> 文件还是有更好的方法?

最佳答案

像这样的东西应该可以工作:

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

// do data binding here

关于c# - 如何创建 .aspx 页面列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10062525/

相关文章:

c# - 将 ASMX 转换为 WCF Web 服务需要付出多少努力?

javascript - 启用具有不同元素的复选框

php - 使用同一数据表中的 ajax 填充下拉列表

.net - 使用 PowerShell,如何将文件添加到新创建的文件集合中?

c# - 如何在 Windows 中获取 z 顺序?

jquery - 如何使用 CSS 过渡动画下拉菜单?

c# - WINFORM 或 WPF : How to trigger custom event inside the constructor of the class that emits it

c# - Visual C# SQL 语句不会插入到数据库中

c# - 隐式转换数组

.net - 已找到应用程序依赖项 list (Test.deps.json) 中指定的程序集,但具有不同的文件扩展名 :