/// <summary> /// Reloads the data. /// </summary> /// <returns>If reloading failed returns false, else returns true</returns> public bool ReloadData() { try { MapProvider.ReloadData(); // Expand current node parent if ((ExpandNodeID <= 0) && (SelectedNode != null)) { ExpandNodeID = SelectedNode.NodeParentID; } // If expand node set, set the node to expand if (ExpandNodeID > 0) { // Get node list to expand expandNodes.Clear(); TreeNode node = TreeProvider.SelectSingleNode(ExpandNodeID, TreeProvider.ALL_CULTURES); if (node != null) { TreeSiteMapNode targetNode = MapProvider.GetNodeByAliasPath(node.NodeAliasPath); if (targetNode != null) { int targetNodeId = (int)targetNode.NodeData["NodeID"]; expandNodes.Add(targetNodeId); while (targetNode.ParentNode != null) { int targetParentNodeId = (int)((TreeSiteMapNode)targetNode.ParentNode).NodeData["NodeID"]; expandNodes.Add(targetParentNodeId); targetNode = (TreeSiteMapNode)targetNode.ParentNode; } } } } treeElem.Nodes.Clear(); // Add root node treeElem.Nodes.Add(CreateNode(RootNode, 0, false)); // Raise root node created event RaiseRootNodeCreated(); return(true); } catch (Exception ex) { lblError.Text = GetString("ContentTree.FailedLoad"); EventLogProvider.LogException("ContentTree", "LOAD", ex, SiteContext.CurrentSiteID); return(false); } }
public void ReloadData() { try { MapProvider.ReloadData(); // Expand current node parent if ((ExpandNodeID <= 0) && (NodeID > 0)) { if (SelectedNode != null) { ExpandNodeID = SelectedNode.NodeParentID; } } // If expand node set, set the node to expand if (ExpandNodeID > 0) { // Get node list to expand expandNodes.Clear(); TreeNode node = TreeProvider.SelectSingleNode(ExpandNodeID, TreeProvider.ALL_CULTURES); if (node != null) { TreeSiteMapNode targetNode = MapProvider.GetNodeByAliasPath(node.NodeAliasPath); if (targetNode != null) { int targetNodeId = (int)targetNode.NodeData["NodeID"]; expandNodes.Add(targetNodeId); while (targetNode.ParentNode != null) { int targetParentNodeId = (int)((TreeSiteMapNode)targetNode.ParentNode).NodeData["NodeID"]; expandNodes.Add(targetParentNodeId); targetNode = (TreeSiteMapNode)targetNode.ParentNode; } } } } treeElem.Nodes.Clear(); // Add root node treeElem.Nodes.Add(CreateNode((TreeSiteMapNode)MapProvider.RootNode, 0, false)); } catch (Exception ex) { lblError.Text = GetString("ContentTree.FailedLoad") + ": " + ex.Message; lblError.ToolTip = EventLogProvider.GetExceptionLogMessage(ex); } }