/// <summary> /// Handle node is populated. /// </summary> protected void PopulateNode(TreeNode node) { if (node != null) { int nodeID = ValidationHelper.GetInteger(node.Value, 0); // Get child nodes List <UniTreeNode> childNodes = ProviderObject.GetChildNodes(node.Value); // Add to treeview foreach (UniTreeNode childNode in childNodes) { // Get ID int childNodeId = ((Metric)childNode.ItemData).MetricId; // Don't insert one object more than once if ((childNodeId != nodeID)) { TreeNode createdNode = CreateNode(childNode); RaiseOnNodeCreated(childNode, ref createdNode); if (createdNode != null) { node.ChildNodes.Add(createdNode); } } } } }
/// <summary> /// Handle node is populated. /// </summary> private void OnNodePopulate(TreeNode node) { if ((ProviderObject != null) && (node != null)) { string[] splitted = node.Value.Split('_'); int nodeID = ValidationHelper.GetInteger(splitted[0], 0); // Get node object type string nodeObjectType = string.Empty; if (splitted.Length == 2) { nodeObjectType = splitted[1]; } // Get child nodes SiteMapNodeCollection childNodes = ProviderObject.GetChildNodes(node.Value, node.Depth + 1); // Add to treeview foreach (UniTreeNode childNode in childNodes) { // Get ID int childNodeId = (int)(((DataRow)childNode.ItemData)[ProviderObject.IDColumn]); // Get object type string childNodeType = string.Empty; if (!string.IsNullOrEmpty(ProviderObject.ObjectTypeColumn)) { childNodeType = ValidationHelper.GetString((((DataRow)childNode.ItemData)[ProviderObject.ObjectTypeColumn]), ""); } // Don't insert one object more than once if ((childNodeId != nodeID) || (nodeObjectType != childNodeType)) { TreeNode createdNode = CreateNode(childNode); if (OnNodeCreated != null) { createdNode = OnNodeCreated((DataRow)childNode.ItemData, createdNode); } if (createdNode != null) { node.ChildNodes.Add(createdNode); } } } } }