Hi,
I have a treeview loading dynamically from a web service which is all working fine. I have enabled server side drag n drop with a AjaxManager linked to the treeview.
It all works fine, but if you drag a node to a currently collapsed node, it will show the new node just dragged to it (as if it is expanded) but wont show the existing nodes until you manually click on it (where it loads from the webservice) Once it has done the load from the webservice it will then have a duplicate node of the one you have just added.
This issue sort of makes sences as in the drag n drop function it is adding the node from the serverside and then when the node is clicked it loads all the nodes from the database which will included the node that has just been moved - so will result in a duplicate.
is there anyway rather than adding the node in this function - to just cause a reload from the webservice of the parent node where the node has just been dragged to - so instead of adding the node in manually - it can just load the information from the webservice.
Unless theres something else i should be doing?
thanks
Toby
I have a treeview loading dynamically from a web service which is all working fine. I have enabled server side drag n drop with a AjaxManager linked to the treeview.
It all works fine, but if you drag a node to a currently collapsed node, it will show the new node just dragged to it (as if it is expanded) but wont show the existing nodes until you manually click on it (where it loads from the webservice) Once it has done the load from the webservice it will then have a duplicate node of the one you have just added.
This issue sort of makes sences as in the drag n drop function it is adding the node from the serverside and then when the node is clicked it loads all the nodes from the database which will included the node that has just been moved - so will result in a duplicate.
private void PerformDragAndDrop(RadTreeViewDropPosition dropPosition, RadTreeNode sourceNode, |
RadTreeNode destNode) |
{ |
if (sourceNode.Equals(destNode) || sourceNode.IsAncestorOf(destNode)) |
return; |
sourceNode.Owner.Nodes.Remove(sourceNode); |
int iSourceNodeParentId = -1; |
int iSourceNodeId = Convert.ToInt32(sourceNode.Value); |
int iDestinationNodeId = Convert.ToInt32(destNode.Value); |
if (sourceNode.ParentNode != null) |
iSourceNodeParentId = Convert.ToInt32(sourceNode.ParentNode.Value); |
else |
iSourceNodeParentId = -1; |
int iGroupViewId = Convert.ToInt32(sourceNode.Attributes["GROUPVIEWID"]); |
WebSession webSess = (WebSession)Session["WebSession"]; |
switch (dropPosition) |
{ |
case RadTreeViewDropPosition.Over: |
// child |
if (!sourceNode.IsAncestorOf(destNode)) |
{ |
destNode.Nodes.Add(sourceNode); |
// update db |
webSess.MasterSystem.GroupsSystem.MoveNode(sourceNode.Value, destNode.Value); |
} |
break; |
case RadTreeViewDropPosition.Above: |
// sibling - above |
destNode.InsertBefore(sourceNode); |
// update db |
webSess.MasterSystem.GroupsSystem.MoveNodeOrder(iSourceNodeId, iSourceNodeParentId, iGroupViewId, ConfigurationConsts.NodeOrderDirection.nodUp); |
break; |
case RadTreeViewDropPosition.Below: |
// sibling - below |
destNode.InsertAfter(sourceNode); |
// update db |
webSess.MasterSystem.GroupsSystem.MoveNodeOrder(iSourceNodeId, iSourceNodeParentId, iGroupViewId, ConfigurationConsts.NodeOrderDirection.nodDown); |
break; |
} |
} |
is there anyway rather than adding the node in this function - to just cause a reload from the webservice of the parent node where the node has just been dragged to - so instead of adding the node in manually - it can just load the information from the webservice.
Unless theres something else i should be doing?
thanks
Toby