CatalogSiteMapProvider - Why do NextSibling & PreviousSibling methods return null?
My implementation of the Starter site needs to allow navigation to the CurrentNode's siblings. I've added in a new method to the CatalogSiteMapProvider as follows:
public
classCatalogSiteMapProvider :SiteMapProvider{public
SiteMapNodeCollection GetSiblingNodes(SiteMapNode node){
SiteMapNode originalNode = node;if (node ==null){
thrownewArgumentNullException("node");
}
SiteMapNodeCollection siblings =newSiteMapNodeCollection();
bool continueLoop =true;
while (continueLoop)// Get to the First sibling
{
if (node.PreviousSibling !=null)
elsenode = node.PreviousSibling;
false;continueLoop =
}
continueLoop =
true;while (continueLoop)// Iterate through siblings, add all but the originalNode{
if (node != null)
{
if (node != originalNode)
siblings.Add(node);
node = node.NextSibling;
}
else
continueLoop = false;
}
// Return collection if full, else return empty objectif (siblings !=null)return siblings;else
returnnewSiteMapNodeCollection();
}
}
However, when I step through this code, the PreviousSibling and NextSibling methods return "null" and I can't see why.
Another method I looked at was to do:
SiteMapNodeCollectionsiblings = CatalogSiteMapProvider.GetChildNodes(CurrentNode.ParentNode)
but again, this returns null.
Can anyone help me with this?
Thanks!!
Nat

