This is a migrated thread and some comments may be shown as answers.

Multiple RadTreeNode node

2 Answers 41 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 21 Feb 2013, 06:49 AM
i am current able to get all users for the first node (teamLeaderNode), but on the second node (projectGroupNode) it only add one node, even there are more record for projectgroupnode. projectSubGroupNode is only 1 record display even more record on the database. WOuld you be able advise, thank you



 private void BuildProjectTree()
        {
    
            EntityCollection<VwProjectCollectionEntity> collection = GetProjectData();
    
            treProjects.Nodes.Clear();
    
            ArrayList pgnodes = new ArrayList();
    
            RadTreeNode teamLeaderNode = null;
            RadTreeNode projectGroupNode = null;
            RadTreeNode projectSubGroupNode = null;
            RadTreeNode projectUserResponsibleNode = null;
            RadTreeNode projectWorkplaneNodeNode = null;
            RadTreeNode projectNode = null;
    
            foreach (VwProjectCollectionEntity p in collection)
            {
                teamLeaderNode = null;
                foreach (RadTreeNode n in pgnodes)
                {
                    if (n.Text.Trim().ToUpper() == p.TeamLeader.Trim().ToUpper())
                    {
                        
                        teamLeaderNode = n;
                        break;
                      
                    }
                   
                }
                if (teamLeaderNode != null)
                {
                    projectGroupNode = null;
                    foreach (RadTreeNode n in teamLeaderNode.Nodes)
                    {
    
                        if (n.Text.Trim() == p.ProjectGroupName.Trim())
                        {
                            projectGroupNode = n;
                            break;
                        }
    
                    }
    
    
                    if (projectGroupNode != null)
                    {
                        projectSubGroupNode = null;
                        foreach (RadTreeNode n in projectGroupNode.Nodes)
                        {
                            if (n.Text.Trim() == p.ProjectSubGroupName.Trim())
                            {
                                projectGroupNode = n;
                                break;
                            }
    
                        }
                        if (projectSubGroupNode != null)
                        {
                            projectNode = null;
                            foreach (RadTreeNode n in projectSubGroupNode.Nodes)
                            {
                                if (n.Text.Trim() == p.ProjectTitle.Trim())
                                {
                                    projectNode = n;
                                    break;
    
                                }
                            }
                        }
    
                    }
    
    
                }
                else
                {
    
                    teamLeaderNode = new RadTreeNode(p.TeamLeader.ToUpper());
                    projectGroupNode = new RadTreeNode(p.ProjectGroupName.Trim(), String.Empty);
                    projectSubGroupNode = new RadTreeNode(p.ProjectSubGroupName.Trim());
                    projectNode = new RadTreeNode(p.ProjectTitle.Trim() + " (" + p.ReferenceNumber + " " + "-" + " " + p.ProjectStatusName + ")",
                                                                      p.ProjectId.ToString(), BuildProjectNavigationUrl2(p, false));
    
                    pgnodes.Add(teamLeaderNode);
                    teamLeaderNode.Nodes.Add(projectGroupNode);
                    projectGroupNode.Nodes.Add(projectSubGroupNode);
                    projectSubGroupNode.Nodes.Add(projectNode);
                }
    
            }
    
            //pgnodes.Add(teamLeaderNode);
            foreach (RadTreeNode pg in pgnodes)
            {
    
                treProjects.Nodes.Add(pg);
            }
            //treProjects.ExpandAllNodes();
            treProjects.CollapseAllNodes();
            
        }

2 Answers, 1 is accepted

Sort by
0
Steven
Top achievements
Rank 1
answered on 25 Feb 2013, 06:53 AM
Is there any methods to remove duplicate nodes. Please advise. thx
0
Bozhidar
Telerik team
answered on 25 Feb 2013, 09:26 AM
Hi,

Since you are creating the TreeView programmatically the issue is most probably related to the data you are binding it to. Unfortunately I don't have the data you are using, so it's impossible for me to reproduce the issue on my end.

What I would suggest is to check whether the GetProjectData method returns all the nodes you are expecting. Also, you can try substituting RadTreeView for the ASP.NET TreeView and see whether it binds correctly. If it does, then the issue is caused by RadTreeView itself and we will do our best to resolve the issue.
 

Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TreeView
Asked by
Steven
Top achievements
Rank 1
Answers by
Steven
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or