I have a Treeview created in virtual mode which have 4 levels of nodes and at the page load the root element and first level elements are loaded and rest will be loaded based on dynamically using treeFolderList_VirtualModeCreateChildren
event.
This is what I have so far
protected void treeFolderList_VirtualModeCreateChildren(object source, TreeViewVirtualModeCreateChildrenEventArgs e)
{
List<TreeViewVirtualNode> children = new List<TreeViewVirtualNode>();
if (e.NodeName == null)
{
AppendChildNode(children, "root", "All Domains", false);
}
else
{
if (e.NodeName.Contains("root"))
{
PopulateChildNodes(false, children);
}
else
{
if (!(e.NodeName.StartsWith("u_")))
{
PopulateUserChildNodes(false, children, GetDomainBase(e.NodeName), e.NodeName);
}
else
{
TreeViewVirtualNode tvNode = (TreeViewVirtualNode)treeFolderList.Nodes.FindByName(e.NodeName);
TreeViewVirtualNode tvNodeParent = (TreeViewVirtualNode)tvNode.Parent;
string tvParentNodeName = tvNodeParent.Name;
PopulateUserChildNodes(true, children, GetDomainBase(tvParentNodeName), e.NodeName);
}
}
}
e.Children = children;
}
This work as expected and it creates the children elements when expanding nodes respectively. My problem is I have check boxes for each node and I need to be able to save the Treeview
in a way when I reload/redirect to the page it would reflect the nodes I have selected.
Is there a way to achieve this?