Home - Forums-.NET - FlyTreeView (ASP.NET) - Drag&drop and SelectedNodeChanged event

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Drag&drop and SelectedNodeChanged event
Link Posted: 29-Mar-2009 05:55
We are using Flytreeview version V 4.3.6.119.
We need drag&drop function to move/copy node. We use also SelectedNodeChanged event to update a Dridview.
When we begin drag&drop(mousedown), It first trigger SelectedNodeChanged event , so the Gridview updated  (which is not we wanted).Then it continues to perform drag&drop operation. The code is as following:

                        Padding="7px" DrawLines="true" FadeEffect="true" PostBackOnSelect="true"            PostBackOnDeselect="false"
                        PostBackOnClick="false" SelectNodeOnRightClick="false" ContentClickExpands="true"
                        OnSelectedNodeChanged="flyTreeView_SelectedNodeChanged" OnPopulateNodes="flyTreeView_PopulateNodes"
                        DragDropName="treeviewnode" DragDropAcceptNames="treeviewnode, dragname" RootDragDropAcceptNames="treeviewnode,dragname"
                        PostBackOnDropAccept="true" OnNodeMoved="flyTreeView_NodeMoved" OnInsertCallbackNodesFromValue="flyTreeView_InsertCallbackNodesFromValue">
                                                    RowHeight="16px" Padding="1px;4px;4px;1px" />
                                                    BorderWidth="1px" ForeColor="White" Padding="0px;3px;3px;0px" />
                        
                    


How kan we distinguish between a drag&drop and a left click ? It seems both trigger mousedown event, which fire SelectedNodeChanged event.

How can we drag&drop without fire SelectedNodeChanged event?


Thanks in advance.
Link Posted: 29-Mar-2009 22:42
I'm not sure how you are going to distinguish.
But there are several things to play with.
There's OnSelectedNodeChangingJavascript where you can return false to prevent node selection.
You can also put inner HTML structure (like DIV) with its own handlers that prevents event bubbling. So you can call node.select() for click event and prevent it for mousedown (using OnSelectedNodeChangingJavascript handler).

See details for client-side events at
http://www.9rays.net/asp.net_2/treeview/miscpages/doc/ClientEvents.aspx
Link Posted: 30-Mar-2009 08:06
Hej,
Thanks for your reply.

I tried OnSelectedNodeChangingJavascript earlier.  For both drag&drop and left click, I got
window.event.type are mousedown.

How to "put inner HTML structure with its own handlers" on a node?  Can you give me an example?
Link Posted: 31-Mar-2009 00:45
I mean node.Text = "
original node text
";