Home - Forums-.NET - FlyTreeView (ASP.NET) - How to use binding.ExpandedField

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

How to use binding.ExpandedField
Link Posted: 17-Jan-2008 04:58
Hi,

I am using ConvertTabularDataToHierarchical to print my tree.

I want to use these properties:
FlyNodeBinding binding = new FlyNodeBinding();
        binding.TextField = "Title";
        binding.ToolTipField = "Description";
        binding.ImageUrlField = "ImageUrl";
        binding.ExpandedField = "Expanded";
        flyTreeView.DataBindings.Add(binding);

but when I add the values from the table I get an error when I want to set "Expanded" to false.

        dTable.Rows.Add(new object[] { "UnitID", null, "ProductConceptName", "Description", "icon.gif", false });
Link Posted: 17-Jan-2008 06:08
How do you set up dTable?

Or better full code, so I can check it out here.

Thanks.
Link Posted: 17-Jan-2008 21:43
Hi,

Here's my code:

private void BuildTree()
    {
        DataSet dSet = new DataSet("DataBase");
        DataTable dTable = new DataTable("TreeData");
        dSet.Tables.Add(dTable);

        dTable.Columns.Add("ID");
        dTable.Columns.Add("OwnerID");
        dTable.Columns.Add("Title");
        dTable.Columns.Add("Description");
        dTable.Columns.Add("ImageUrl");
        dTable.Columns.Add("Expanded");

        FlyNodeBinding binding = new FlyNodeBinding();
        binding.TextField = "Title";
        binding.ToolTipField = "Description";
        binding.ImageUrlField = "ImageUrl";
        binding.ExpandedField = "Expanded";
        flyTreeView.DataBindings.Add(binding);

        //Print the top node:
        dTable.Rows.Add(new object[] {
           "FunctionalUnitID",
           null,
           pcInfo.Tables[0].Rows[0]["ProductConceptName"].ToString().Trim(),
           pcInfo.Tables[0].Rows[0]["ProductConceptDescription"].ToString().Trim(),
           "~/App_Themes/Default/Images/MpG.gif",
          false
       });

    

// Call FlyTreeView.ConvertTabularDataToHierarchical method to convert into hierarchical datasource
        IHierarchicalEnumerable hierarchicalData =
            NineRays.WebControls.FlyTreeView.ConvertTabularDataToHierarchical(dSet, "TreeData", "ID", "OwnerID");

        // Bind the treeview
        flyTreeView.DataSource = hierarchicalData;
        flyTreeView.DataBind();
}
Link Posted: 18-Jan-2008 01:15
Great.
A data binding bug was found and fixed. (it didn't always correctly converted nullable types).

See the latest build at our downloads section:
http://www.9rays.net/download.aspx?productFamily=TreeView_ASP.NET_2

Thanks for cooperation