Home - Forums-.NET - FlyTreeView (ASP.NET) - Problem deleting node after drag and drop

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Problem deleting node after drag and drop
Link Posted: 26-Jan-2007 10:44
Problem deleting node after drag and drop


I have two treeview controls.  When I drag a node from one treeview to another, I am trying to delete the node that was just dragged in the OnDropJavascript event handler.  I am using the flytreeview_dragObject to get the instance of the node just dragged and then calling the remove method like this


function flyTreeView1_OnDrop(target, event)
{  

       flytreeview_dragObject.value.remove();
}


I want to do some custom processing based on the node that was just dragged and dropped but I don't want that node to get moved or copied over; thats why I want to delete it as soon as it is dropped.  I want the node that was dropped to disappear from all trees once it is dropped.  I keep getting this javascript error when I try to execute the remove line.

'_fv248' is null or not an object.

I am using the 2.0 version of the control flytreeview.
Link Posted: 26-Jan-2007 23:16
From docs:
[boolean] OnDropJavascript ([CFlyTreeNode] target, [event] event)
Fired when a dragObject is dropped onto treeview node (target). Return false to cancel the drop.


To remove node from the source treeview and not let it add to the second treeview you should just modify your code to return false:

function flyTreeView1_OnDrop(target, event)
{
    flytreeview_dragObject.value.remove();
    return false;
}


When you call to  flytreeview_dragObject.value.remove(); the node is removed from the treeview.
The error you get occurs just because the D&D framework tries to remove the node for the second time.