Home - Forums-.NET - FlyTreeView (ASP.NET) - Force 'Copy' instead of 'Move' for one node level

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Force 'Copy' instead of 'Move' for one node level
Link Posted: 16-Oct-2006 23:32
and keep the standard functionality (using the Ctrl key) for other levels. I need to be able to drop nodes from my Treeview at level 1 onto a textbox but not remove them from the Tree. The textbox is placed between tags and I use the 'onmouseover' and 'omouseout' events within the tags to handle the drop - which works great. I need to be able to force the node to 'copy' regardless of the status of the Ctrl key (only for this type of drop- nodes from other levels, or those dropped onto the tree need to respect the Ctrl key). I've tried to return \"2\" or false from the onmouseover event but that does not affect the outcome. In http://www.9rays.net/forums/viewtopic.php?t=921&highlight=copy+move you mention \"Currently you should handle the OnDragOverJavascript client-side handler in order to return value \"2\" from it. It means the copy operation.\" but I don't think I can access this handler on dropping to a textbox. One way which nearly works is to use the flytreeview_dragObject.cancel() method immediately after I grab the node attributes to fill my textbox. This does indeed give me the correct result, but then causes a Javascript error ('flytreeview_dragObject.state' is null or not an object) - interestingly it lists line 2048 as the offending position of the error and the source page only has 650 or so lines.... Many thanks.
Link Posted: 17-Oct-2006 05:27
http://www.9rays.net/asp.net_2/treeview/Doc_DragDrop.aspx

See flytreeview_dragObject.

So the code should look like the following:

if (flytreeview_dragObject) {
    flytreeview_dragObject.defaultMode = 1;
    // 1 - move,
    // 2 - copy,
    // 3 - defined by Ctrl (move default),
    // 4 - defined by Ctrl (copy default).
    flytreeview_dragObject.update();
}
Link Posted: 17-Oct-2006 05:33
Finally found the answer....

Changing onmouseover=\"flytreeview_dragOver('dragname,treeviewnode', dragTo_OnDrop2);\" to onmouseover=\"flytreeview_dragOver('dragname,treeviewnode', dragTo_OnDrop2, 2);\" (adding the parameter 2 at the end)

overrides the defaultsetting and worked a treat....

Thanks.
Link Posted: 17-Oct-2006 05:35
Evgeny, looks like we were writing our answers at the same time.

I did try the method you suggested but it didn't work... not sure why.