Home - Forums-.NET - FlyTreeView (ASP.NET) - Populating child nodes

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Populating child nodes
Link Posted: 14-Feb-2007 04:49
I am trying out the control and have problems getting the child nodes to populate. I have tabular data, converted to xml using the supplied routine. What happens in the root node (parent id is null) displays ok as does the next level down. However any at this level that have children display \"system.data.datarowview\" as the text.

the code:

   Dim Dt As New DataTable

            Dt = cs.Utils.DbHelper.ExecuteDataTable(\"cssp_usr_get_tree\", Context.User.Identity.Name)
            Dt.Rows.Add(New Object() {0, Nothing, 1, \"Your Groups\", 0, 0})
            ' Call FlyTreeView.ConvertTabularDataToHierarchical method to convert into hierarchical datasource
            Dim hierarchicalData As IHierarchicalEnumerable = NineRays.WebControls.FlyTreeView.ConvertTabularDataToHierarchical(Dt, \"site_id\", \"Parent\")
            ' Bind the treeview
            flyTreeView.DataSource = hierarchicalData
            flyTreeView.DataBind()


My databind source has all the data need including the child nodes so I shouldn't have to populate on demand right? I've checked the table and the id's and parent id's are all correct.

Any idea what I'm doing wrong?
Link Posted: 14-Feb-2007 06:23
So you have ConvertTabularDataToHierarchical converting ok?


Is this for the root node?
Dt.Rows.Add(New Object() {0, Nothing, 1, \"Your Groups\", 0, 0})



What are the column names for in your datatable?
Link Posted: 14-Feb-2007 12:18
[quote="EvgenyT"]So you have ConvertTabularDataToHierarchical converting ok?


Is this for the root node?
Dt.Rows.Add(New Object() {0, Nothing, 1, "Your Groups", 0, 0})



What are the column names for in your datatable?


I assume its converting ok. No errors and I get the root and top nodes displaying ok. It also shows the nodes that have children so its getting the data that child nodes exists for these.

the dt.rows.add is for the root node and this works fine.

Columns are below:

site_id (id of the node)
Parent (which parent node this child node belongs to)
Title

thats it.
Thanks
Link Posted: 14-Feb-2007 22:02
I believe that you need to use FlyTreeView.DataBindings collection to properly bind Title column to FlyTreeNode.Text property.

If you want to do this programmatically (not in your ASPX markup), you'll need to do something like this (C#):

NineRays.WebControls.FlyNodeBinding binding = new NineRays.WebControls.FlyNodeBinding();
binding.TextField = \"Title\";
flyTreeView.DataBindings.Add(binding);


Insert the code before the DataBind() call.
Link Posted: 15-Feb-2007 05:43
[quote="EvgenyT"]I believe that you need to use FlyTreeView.DataBindings collection to properly bind Title column to FlyTreeNode.Text property.

If you want to do this programmatically (not in your ASPX markup), you'll need to do something like this (C#):

NineRays.WebControls.FlyNodeBinding binding = new NineRays.WebControls.FlyNodeBinding();
binding.TextField = "Title";
flyTreeView.DataBindings.Add(binding);


Insert the code before the DataBind() call.


Tried this but it didn't work. Would populate on demand work any better/differently?
Link Posted: 15-Feb-2007 06:45
No, you do not need to use populate on demand.

You're definitely missing something with column names or etc.

The FlyTreeView data binding function is similar to standard DataBinder.Eval implementation. So it gets Title property/datarow field from DataRow you have in datatable (this is specified with DataBindinigs).

How do you set DataBindings? Do you use ASPX markup for it? Could you please post your FlyTreeView tags content here.

Thanks.