bind custom sitemap to menu
<p>I have a custom site map built.</p>

<pre><code> public class CustomSiteMapProvider : StaticSiteMapProvider
     {
DataClassesDataContext d = new DataClassesDataContext();
SiteMapNode _root = null;
IEnumerable&lt;MenuBuild&gt; menuItems;
public CustomSiteMapProvider()
{

    menuItems = (from item in d.MenuBuilds
                 select item);


}

public override SiteMapNode BuildSiteMap()
{
    if (_root != null)
        return _root;
    Dictionary&lt;Guid, SiteMapNode&gt; nodes = new Dictionary&lt;Guid, SiteMapNode&gt;();
    String id = "-1";
    _root = new SiteMapNode(this, id, "~/Default.aspx", "Home", String.Empty);


    AddNode(_root, null);  //node, Parentnode
    int parentId =0;
    SiteMapNode rootNode =_root;
    CreateSubMenu(parentId, rootNode);


    return _root;
}

private void CreateSubMenu(int parentId, SiteMapNode rootNode)
{
    menuItems.Where(item =&gt; (item.Parent == null || item.Parent == parentId))
        .ToList().ForEach(
        nodeItem =&gt; AddNode(new SiteMapNode(this, nodeItem.ID.ToString(), nodeItem.Url,  
                   nodeItem.Item, String.Empty),
             rootNode));

    foreach (SiteMapNode node in rootNode.ChildNodes)
    {
        CreateSubMenu(int.Parse(node.Key), node);
    }

}

protected override SiteMapNode GetRootNodeCore()
{
    BuildSiteMap();
    return _root;
}
}
</code></pre>

<p>However, this only returns the parent element but not the child elements of the parent.Can u let me know the mistake I'm doing.. however my table consists of ID(autoincremented),item(title of menu), Url,parent.</p>
