【问题标题】:tree navigation to show folder structure树导航以显示文件夹结构
【发布时间】:2011-09-12 04:36:15
【问题描述】:

项目:带有 C# 的 ASP.NET 3.5

我有这么多:- 用于存储“文件夹”的表。每个文件夹可能包含子文件夹和文件。因此,如果我单击一个文件夹,我必须列出该文件夹的内容。

所以我想告诉用户他现在在哪里,如下所示

父文件夹 --> 子文件夹1 --> 子文件夹1_1

我应该在这里使用哪个 ASP.NET 控件?我怎样才能完成这项任务?

我认为 SiteMapPath 是最好的选择。你怎么看?

【问题讨论】:

    标签: asp.net controls directory


    【解决方案1】:

    我希望文件夹结构可以是动态的,所以使用 SiteMap 控件有些困难。我建议您手动执行此操作,以维护 ViewState/SessionState 存储变量。

    在更改文件夹时更新变量/属性。

     public System.Collections.Generic.List<string> FolderPath
        {
            get
            {
                if (ViewState["__FolderPath"] == null)
                    ViewState["__FolderPath"] = new System.Collections.Generic.List<string>();
                (System.Collections.Generic.List<string>)ViewState["__FolderPath"];
            }
            set
            {
                ViewState["__FolderPath"] = value;
            }
        }
        public string CurrentPath
        {
            get
            {
                //retrun the current path from the List FolderPath. ;
            }
        }
    

    【讨论】:

      【解决方案2】:

      您可以使用 TreeView 控件实现此目的

      【讨论】:

        【解决方案3】:

        您还可以查看 oBout TreeView,它是 Microsoft Treeview 控件的出色升级:

        http://www.obout.com/t2/index.aspx

        【讨论】:

          猜你喜欢
          • 2017-06-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-12-12
          • 2021-10-21
          • 1970-01-01
          相关资源
          最近更新 更多