title: Document Library Folders in Folder Hierarachy not match when load in Asp TreeView Programmatically
body: <p>Document Library which contains Folders and Files, Successfully show items with proper relation but folder in folder Hierarchy not match properly
  <a href="http://oi62.tinypic.com/nyembb.jpg" rel="nofollow">http://oi62.tinypic.com/nyembb.jpg</a></p>
  
  <p>Currently Items maintain in Document Library as in Picture A, but my code generate as in Picture B</p>
  
  <pre><code>using (var site = new SPSite(projectInitiationRequest.ProjectUrl))
  {
      using (SPWeb web = site.RootWeb)
      {
          SPDocumentLibrary myDocLib = (SPDocumentLibrary)web.Lists[Constants.ProjectLibrary];
  
          for (int i = 0; i &lt; myDocLib.Folders.Count; i++)
          {
              TreeNode treeHeadNode = new TreeNode();
              treeHeadNode.Text = myDocLib.Folders[i].Name;
              treeHeadNode.Value = myDocLib.Folders[i].ID.ToString();
              treeHeadNode.ShowCheckBox = false;
              treeView1.Nodes.Add(treeHeadNode);
  
              for (int j = 0; j &lt; myDocLib.Items.Count; j++)
              {
                  if (myDocLib.Items[j].File.ParentFolder.Name == myDocLib.Folders[i].Name)
                  {
                      TreeNode treeChildNode = new TreeNode();
                      treeChildNode.Text = myDocLib.Items[j].Name;
                      treeChildNode.Value = myDocLib.Items[j].ID.ToString();
                      treeChildNode.NavigateUrl = myDocLib.Items[j].Url;
                      treeHeadNode.ChildNodes.Add(treeChildNode);
                  }
              }
          }
      }
  }
  </code></pre>