Treeview Node reference getting changed

  • Thread starter Thread starter Sudip_inn
  • Start date Start date
S

Sudip_inn

Guest
my scenario

1599902.png

when i am dragging Net Revenue node from Node AAA and adding to Node BBB then i am first removing node Net Revenue from Node AAA and then i add it to Node BBB.

so after removing node, when i add it to BBB then dragged node parent is getting changed. so tell me how could i store the dragged node reference which exist same ever after deleting dragged node.

TreeNode tmpDragNode = draggedNode;
draggedNode.Remove();
targetNode.Nodes.Add(draggedNode);
//draggedNode.Tag = lidraggedNode;
tdstargetNode.LineItemNodes.Add(lidraggedNode);
targetNode.Tag = tdstargetNode;

if (dragNodeParent.LineItemNodes.Any(x => x.LineItemID == lidraggedNode.LineItemID))
{
dragNodeParent.LineItemNodes.RemoveAll(x => x.LineItemID == lidraggedNode.LineItemID);
tmpDragNode.Parent.Tag = dragNodeParent;
}

this way i store the dragged node before delete the node TreeNode tmpDragNode = draggedNode;

after deletion

draggedNode.Remove();
targetNode.Nodes.Add(draggedNode);

This reference tmpDragNode holding different parent reference. so i am facing problem for this. so tell me how could i store

Node reference which will not be changed when i will delete that node and add it to another parent node. please help. thanks

Continue reading...
 
Back
Top