SiteMap issue

Topics: Web Client Software Factory
Mar 10, 2008 at 5:44 PM
I have registered my site map data (pasting some sample code)

protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)
{
SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("Home", "~/Home.aspx", "HomePage");
moduleNode.ImplicitResourceKey = "HomePage";

NameValueCollection attr = new NameValueCollection();
attr.Add("image", "Images/sitemap/folder.jpg");
attr.Add("menuId", "1");
moduleNode.Attributes = attr;
_siteMapBuilderService.AddNode(moduleNode);

_siteMapBuilderService.RootNode.Url = "~/Home.aspx";
_siteMapBuilderService.RootNode.Title = "Home";
}

The problem is while binding the data to treeview (protected void myMenu_ItemDataBound(object sender, RadMenuEventArgs e)) I am unable to get Attribute values of dataItem for making required drawings. The Atrributes are in protected list of DataItem of the node, thus I am unable to reach it.

Can someone help me to understand how to consume the attribute values set in SiteMapNodeInfo object for each node.


Thanks
Armen
Mar 13, 2008 at 1:52 AM
SiteMapNodeInfo has a property Attributes, which should help you. It is a NameValueCollection, so something like
node.Attributes["image"] should get you the string value there.

I hope that helps,
Michael Puleio - patterns & practices
Webhttp://msdn.microsoft.com/practices/
Bloghttp://blogs.msdn.com/mpuleio/