Hi
I'm trying to implement the RadMenu so it works in a similar way to the ASP menu that comes with MOSS by default. I've had some success, but one problem is that the PortalSiteMapDatasSource (sitemapprovider = CombinedNavSiteMapProvider) returns a parent node for the current SharePoint site (dependant upon how you configure your Global site sections under Site Actions - Modify Navigation) and then places all navigation within that site as child nodes beneath it.
Swap the ASP menu with the Telerik RadMenu and all of a sudden I get one menu item on the menu bar with a drop down containing the items that should be on the root level of the menu. It appears that the SharePoint ASP menu combines the first two levels together but RadMenu does not.
<MyCo:MOSSRadMenu id="mossRadMenu" runat="server"
AppendDataBoundItems="false"
MaxDataBindDepth="5"
DataSourceId="siteMapDataSource1"
CollapseDelay="500"
EnableViewState="false"
EnableEmbeddedSkins="false"></MyCo:MOSSRadMenu>
<PublishingNavigation:PortalSiteMapDataSource ID="siteMapDataSource1" Runat="server"
SiteMapProvider="CombinedNavSiteMapProvider" EnableViewState="false"
StartFromCurrentNode="true" StartingNodeOffset="0" ShowStartingNode="true"
TreatStartingNodeAsCurrent="true" TrimNonCurrentTypes="Heading"/>
I can stop this happening in the RadMenu by changing the ShowStartingNode attribute of the PortalSiteMapDataSource to "false", however then the root SharePoint site node disappears from the menu. So I do not want to do that.
Using some code, I was able to move the first level child nodes up one level and this almost works ...
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
// Bring the sub-items up to the main level
RadMenuItem[] mArray = new RadMenuItem[this.Items[0].Items.Count];
this.Items[0].Items.CopyTo(mArray, 0); // Get items of next level down
this.Items[0].Items.Clear(); // clear these items
this.Items.AddRange(mArray); // paste them at the root level
}
... the RadMenu now looks just like the ASP menu, the problem I am left with is that when I am at the root site, the first node on the menu (the site root) is styled to be selected - that is what I want. However when I navigate to another page or site that now appears on the same level of the navigation it will become selected also (again what I want) but the first node (the site root) is still selected - I don't want this to be selected.
For example, if my sharepoint sites look like this:
Portal (Parent root site)
- Site 1 (child site)
- Site 2 (child site)
Which creates the navigation (with the code modification above) in SharePoint as:
[ Portal ] | Site 1 | Site 2
When on the Portal root site (the welcome page for Portal), then Portal is styled to show it as selected.
eg (where [ ] denotes the menu item that is styled as selected):
[ Portal ] | Site 1 | Site 2
However when on Site 1, both Site 1 and Portal are styled to show they are both selected. I want only SIte 1 to be selected in this instance.
eg, this is how it currently is rendered:
[ Portal ] | [ Site 1 ] | Site 2
When I walk through the nodes (In the OnPreRender event) the Selected property is always false so it seems it is not here that the RadMenu is deciding what nodes are selected?
Where / how do I control what nodes in my RadMenu are selected when used in a SharePoint MOSS Publishing site?