帮助文档:
Tabular Data
To bind to tabular data, the FlyTreeView contains a helper static FlyTreeView.ConvertTabularDataToHierarchical method. It converts tabular data source into hierarchical one using the defined key and parent key fields to link parent and child data. For example we have the following tabular data. A database table: ID ParentID Title Value 
1 1 Root Node abc 
2 1 Child1 xyz1 
3 1 Child2 xyz2 
4 2 Child1 of Child1 xyz3 
In this case the ID is a key of the record and ParentID field should be used as a parent key to determin node’s parent node. For root nodes, we should have ParentID (parent key) equal to ID field or equal to null (or DBNull ). For every child node, the ParentID contains ID of its parent node. This is the way the static method can detect child-parent relashions in the data source. Let’s say our example table will have a name “Cities” in a myDataSet dataset. Finally the code that can be used to bind the treeview to the table will look like the following: Code Listing
IHierarchicalEnumerable hierarchicalData = 
    FlyTreeView.ConvertTabularDataToHierarchical(myDataSet, "Cities", "ID", "ParentID");
FlyTreeView.DataSource = hierarchicalData;
FlyTreeView.DataBind();public partial class menu : System.Web.UI.Page
{
    static string conString = WebConfigurationManager.ConnectionStrings["dpCompanyConnectionString"].ConnectionString;
    protected void Page_Load(object sender, EventArgs e)
    {        SqlDataAdapter thisAdapter = new SqlDataAdapter("select * from list", conString);
        DataSet thisDataSet = new DataSet();
        thisAdapter.Fill(thisDataSet, "tableList");
        //DataTable newtable = new DataTable();
        //thisAdapter.Fill(newtable);
        IHierarchicalEnumerable hierarchicalData = FlyTreeView1.ConvertTabularDataToHierarchical(tableList, "tital", "ID", "ParentID");
        FlyTreeView1.DataSource = hierarchicalData;
        FlyTreeView1.DataBind();
    }
}无法通过编译,应该如何解决?
谢谢!

解决方案 »

  1.   

    FlyTreeView1.ConvertTabularDataToHierarchical(thisDataSet, "tital", "ID", "ParentID");
      

  2.   

    改成 FlyTreeView1.ConvertTabularDataToHierarchical(thisDataSet, "tital", "ID", "ParentID");

    错误 1 无法使用实例引用来访问成员“NineRays.WebControls.FlyTreeView.ConvertTabularDataToHierarchical(object, string, string, string)”;请改用类型名来限定它 d:\Company\menu.aspx.cs 23 52 d:\Company\
      

  3.   

    public partial class menu : System.Web.UI.Page
    {
        static string conString = WebConfigurationManager.ConnectionStrings["dpCompanyConnectionString"].ConnectionString;
        protected void Page_Load(object sender, EventArgs e)
        {        SqlDataAdapter thisAdapter = new SqlDataAdapter("select * from list", conString);
            DataSet thisDataSet = new DataSet();
            thisAdapter.Fill(thisDataSet, "tableList");
            //DataTable newtable = new DataTable();
            //thisAdapter.Fill(newtable);
            IHierarchicalEnumerable hierarchicalData = FlyTreeView.ConvertTabularDataToHierarchical(thisDataSet , "tableList", "ID", "ParentID");
            FlyTreeView1.DataSource = hierarchicalData;
            FlyTreeView1.DataBind();
        }
    }