ASP.NET TreeView and Root+Child Nodes population
<p>I have the following code of a TreeUtility which i got it from Code Project. I need to implement the same for ASP.NET TreeView population. I dont know where to add root node and where and how to add childnodes. Please help.</p>

<pre><code>public partial class MenuManagement : System.Web.UI.Page
{
  TreeNode rootNode = new TreeNode();
  TreeNode childNode = new TreeNode();

  public void PopulateTreeView()
  {
   IList topLevelCategories =  
   TreeHelper.ConvertToForest(Category.GetAllMenusFromDatabase());

   foreach (Category topLevelCategory in topLevelCategories)   
   {
     //Adding Root Items
     rootNode.Text = topLevelCategory.Name;
     rootNode.Value = topLevelCategory.Id.ToString();
     TreeView1.Nodes.Add(rootNode);

     RenderCategory(topLevelCategory);
   }
  }

 void RenderCategory(Category category)
 {
  if(category.Children.Count &gt; 0)
   { 
    foreach( Category child in category.Children)
     {
         childNode.Text = category.Name;
         childNode.Value = category.Id.ToString();
         rootNode.ChildNodes.Add(childNode);
         RenderCategory(child);
     }
   }
  }
}
</code></pre>
