SysWeb.TreeNode Clusternoed = Clustergroup; Clusternoed = new SysWeb.TreeNode(Children); if (output != "found") { SysWin.MessageBox.Show("No cluster found for" + Children); group.ChildNodes.Add(Clustergroup);//---------->add cluster is working Clustergroup.ChildNodes.Add(Clusternoed); //---> add noed is working . } else { SysWin.MessageBox.Show("Cluster found for :" + Children); //group.ChildNodes.Add(Clustergroup); dont add cluster but only children Clustergroup.ChildNodes.Add(Clusternoed); //--> not working }
// The method CheckIfClusterExist is your method and should return null if no cluster was found TreeNode clusterFound = CheckIfClusterExist("ClusterName"); if (clusterFound == null) { clusterFound = group.ChildNodes.Add(Clustergroup); } clusterFound.ChildNodes.Add(Clusternoed);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)