Home - Forums-.NET - FlyTreeView (ASP.NET) - Bind to DataSet or use GetCheckedNodes

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Bind to DataSet or use GetCheckedNodes
Link Posted: 02-Jul-2007 10:44
I think I may be missing something somewhere.

I can generate my tree using \"ConvertTabularDataToHierarchical\".

My user then ticks checkboxes to make their selection.

On save, however, is where I lose it.

Do I have to use \"GetCheckedNodes\" to find out all my selected nodes?

Doesn't the flytree just update the underlying dataset?

Reason I ask is that \"GetCheckedNodes\" is OK, but I need to see which nodes were \"unselected\" so I can delete the appropriate records.

Maybe someone can enlighten me?

Thanks
Link Posted: 03-Jul-2007 01:10
Yes, FlyTreeView does not update underlying dataset, etc.
So you just convert tabular data into hierarchical one and create treeview from it.


Reason I ask is that \"GetCheckedNodes\" is OK, but I need to see which nodes were \"unselected\" so I can delete the appropriate records.

You can get treeview nodes matching any condition you need.
Actually the GetCkeckedNodes implementation looks like this:


FlyTreeNodeCollection checkedNodes = yourFlytreeview.FindAll(delegate(FlyTreeNode match)
{
    return match.Checked;
});



So unchecked nodes will look like this:

FlyTreeNodeCollection uncheckedNodes = yourFlytreeview.FindAll(delegate(FlyTreeNode match)
{
    return !match.Checked;
});
Link Posted: 03-Jul-2007 01:13
could i instead populate the tag and do a search for the contents of the tag and if the node is unchecked?

btw, i am using vb.
Link Posted: 03-Jul-2007 02:51
You can also use  FlyTreeView.NodeCheckedChanged event.

This is a node-level event that is fired when treeview loads its client-side changes one by one.

So NodeCheckedChanged can fire several times for the same node.

Also, do not modify FlyTreeView in this event handler, because this can break treeview consistency that is required to process next node client-side changes.
Link Posted: 03-Jul-2007 03:08
Please can you give me an example of the findall in VB ASPX DOTNET?

The help file does not say how to set up the Predicate.

I would like to search for all unchecked and a value in the tag if possible.

Thanks
Link Posted: 03-Jul-2007 03:36
The syntax is similar to generic List.FindAll(T match).

You need to setup additional function in VB:

Private Sub IsUncheckedNode(ByVal match As FlyTreeNode)
  Return Not match.Checked
End Sub


And use it somewhere in your code to get unchecked nodes:

uncheckedNodes As FlyTreeNodeCollection = yourFlytreeview.FindAll(AddressOf IsUncheckedNode)