Under ASP.NET 2.0 (c#)
1.Modify your "Web.sitemap" like this:
<siteMap>
<siteMapNode id="0" title="Home" description="Home" url="Default.aspx" target="_blank" img="~/images/home.gif">
<siteMapNode id="1" title="Sky's Program" description="Sky's Program" url="DefaultSky.aspx" ico="">
<siteMapNode id="2" title="Country" description="Area Setting" url="AreaSetting.aspx" />
</siteMapNode>
<siteMapNode id="3" title="Tiger's program" description="Tiger's program" url="DefaultTiger.aspx">
<siteMapNode id="4" title="My program" description="Gateway Setting" url="GateWaySetting.aspx" />
<siteMapNode id="5" title="Others" description="Other Setting" url="Others.aspx" />
</siteMapNode>
</siteMapNode>
2.Create a WebForm and add a Menu control: Menu1
3. Add the code below in your codefile:
protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
{
SiteMapNode mapNode = (SiteMapNode)e.Item.DataItem;
//handle the target attribute of a url
if (mapNode["target"] != null)
{
e.Item.Target = mapNode["target"];
}
//if img is not null ,show the img instead of text
if (mapNode["img"] != null)
{
e.Item.Text = "";
e.Item.ImageUrl = mapNode["img"];
}
//do not display this menu
if (mapNode["visibal"] == "0")
{
e.Item.Text = "";
}
//disable this menu
if (mapNode["enable"] == "0")
{
e.Item.Enabled = false;
}
//do other if ....
}
you can difine many attributes,just its value when the webcontrol bind the data. ^_^