Hi Hector,
I also have been using navigation, except I'm gathering info from the Links list and creating a menu from that. It does ok but 2 problems - 1) the column title appears on the webpart (whereas I want the field values of the column to appear as the 1level of the menu, then the URLs as 'hoverover'; and 2) can't quite get it to work for 2-level 'group by'. As a reminder, the Links list allows 2 levels of grouping. So some users are using 'category' then sub-category' or 'chapter' and 'section' to indicate a 2 level of categorization of the links.
hoping much success!!!
Tony Willeto
I had to use SPSite mySite = new SPSite(this.CurrentSite.Url + pNode.Url), because pNode.Url = "\". This was causing an error "UriFormatException: Invalid URI: The format of the URI could not be determined."
I had to switch two arguments of the SiteMapNode constructor to become SiteMapNode childNode = new SiteMapNode(this, listUrl, listUrl, list.Title).
I could not just add a child node of type SiteMapNode to the collection, as this caused a casting error (could not cast from SiteMapNode to PortalSiteMapNode) downstream. I could not cast one to the other in code either with an explicit case or using the 'as' keyword, since this generated an exception at runtime stating that 'Value of value may not be null'. I tried to use base.AddNode(navnode, pNode), but it generated a 'Not implemented' exception. Through experimentation I came up with the following, which allows the code to run fine, though I am not confident that it produces the results the author of this article intended:
SPSite mySite = new SPSite(this.CurrentSite.Url + pNode.Url);
SPWeb currentWeb = mySite.OpenWeb();
SPListCollection lists = currentWeb.Lists;
foreach (SPList list in lists)
{
string listUrl = list.DefaultViewUrl;
SiteMapNode navnode = new SiteMapNode(this, listUrl, listUrl, list.Title);
PortalWebSiteMapNode pwsn = pNode as PortalWebSiteMapNode;
if (pwsn != null)
{
PortalSiteMapNode psn = new PortalSiteMapNode(pwsn, listUrl, NodeTypes.Area, listUrl, list.Title, "My description");
nodeColl.Add(psn);
}
}
return nodeColl;
Since no one has posted anything here, I would be interested to know if this is simply the result of a difference in configuration between what I have and what was used to produce the sample, or due to a difference in the final MOSS 2007 product from the beta, or ...