Hi I have a TreeView object created on my website using the following code:
In my Page_Load method I call BuildDocumentNavigationTree() as in:
private void BuildDocumentNavigationTree()
{
TreeNode rootNode = new TreeNode(currentDocumentStructure.Label);
rootNode.Value = currentDocumentStructure.UniqueId.ToString();
rootNode.Value = rootNode.Value + " : " + currentDocumentStructure.Title.ToString();
AddChildElementNodes(rootNode, currentDocumentStructure);
TreeView1.Nodes.Add(rootNode);
}
private static void AddChildElementNodes(TreeNode parentNode, DocumentElementType element)
{
foreach (DocumentElementType childElement in element.DocumentElements)
{
TreeNode elementNode = new TreeNode(childElement.Label);
elementNode.Value = childElement.UniqueId.ToString();
elementNode.Value = elementNode.Value + " : " + childElement.Title.ToString();
AddChildElementNodes(elementNode,childElement);
parentNode.ChildNodes.Add(elementNode);
elementNode.CollapseAll();
}
}
This will build my tree successfully and it has quite a few nodes with child nodes etc. Basically a user can navigate through the tree and select a document, and that document will display on screen when selected. They can then click 'Add Comments' which will bring them to a new page to add their comments to that document. On the add comments screen the user can click cancel which brings them back to the document screen, although the tree fully collapses and no longer displays the document.
I therefore need the tree to return to the previously selected state and also display the document of that selected state. Can someone please help me?