Multiple RadTreeNode node

3 posts, 0 answers
  1. Steven
    Steven avatar
    8 posts
    Member since:
    Sep 2011

    Posted 21 Feb 2013 Link to this post

    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. Steven
    Steven avatar
    8 posts
    Member since:
    Sep 2011

    Posted 25 Feb 2013 Link to this post

    Is there any methods to remove duplicate nodes. Please advise. thx
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 25 Feb 2013 Link to this post

    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.
Back to Top