SiteMap issue

Topics: Web Client Software Factory
Mar 10, 2008 at 4: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.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.

Mar 13, 2008 at 12: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