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();
}