Hi SudipBhatt-9737,
You need to add this line(node.TreeView.SelectedNode = node) to restore the originally selected node as selected.
So you need to change you code to the below:
parent.Nodes.Insert(index - 1, node);
node.TreeView.SelectedNode = node;
view.Nodes.Insert(index - 1, node);
node.TreeView.SelectedNode = node;
parent.Nodes.Insert(index + 1, node);
node.TreeView.SelectedNode = node;
view.Nodes.Insert(index + 1, node);
node.TreeView.SelectedNode = node;
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.