I am looking to implement a comparison between the last selected node and the currently selected node on a tree view using JavaScript.
Can anyone provide me with some code snippets to help me compare the previous selection with the current selection on the tree view?
If both node selections are the same, I would like to deselect the node.
Thank you in advance for your assistance.
I have successfully resolved this issue with the following server-side code:
protected void TreeView1_PreRender(object sender, EventArgs e)
{
if (TreeView1.SelectedNode != null)
{
if (!string.IsNullOrEmpty(ADUtility.treenodevalue))
{
if (ADUtility.treenodevalue == TreeView1.SelectedNode.ValuePath)
{
TreeView1.SelectedNode.Selected = false;
}
else
{
ADUtility.treenodevalue = TreeView1.SelectedNode.ValuePath;
}
}
else
{
ADUtility.treenodevalue = TreeView1.SelectedNode.ValuePath;
}
}
}