This is a migrated thread and some comments may be shown as answers.

Why NextSibling and PreviousSibling of CurrentNode getting Null

0 Answers 113 Views
Let's talk about telerik (the good and the bad)
This is a migrated thread and some comments may be shown as answers.
Surya CD
Top achievements
Rank 1
Surya CD asked on 03 Jul 2012, 11:05 AM
Hi,
In our project the menu is done using the telerik radmenu. For some pages that are not shown in navigation, it is throwing an exception.

The website id done using the cms Sitefinity.

'SiteMap.CurrentNode.NextSibling' threw an exception of type 'System.ArgumentNullException' System.Web.SiteMapNode {System.ArgumentNullException}.
It is the same error with PreviousSibling.


public void HorizontalRadMenu_ItemDataBound(object sender, RadMenuEventArgs e)
{
string[] strNavigationPages = { "Home", "About", "Product", "Sales", "Marketing", "Partners", "Resources", "...", "...", "...", "...", "...", "..." };
if (e.Item != null)
{
 
 
if (e.Item.Level == 0)
{
parentPageId = ((Telerik.Sitefinity.Web.PageSiteNode)(e.Item.DataItem)).Id.ToString();
}
 
 
 
 
string currentPageId = ((Telerik.Sitefinity.Web.PageSiteNode)(e.Item.DataItem)).Id.ToString();
string findThisString = e.Item.Text;
 
 
 
 
int strIndex = -1;
int flag = -1;
if (!String.IsNullOrEmpty(findThisString) && ((Telerik.Sitefinity.Web.PageSiteNode)(e.Item.DataItem)).ShowInNavigation)
{
for (int strNumber = 0; strNumber < strNavigationPages.Length; strNumber++)
{
strIndex = strNavigationPages[strNumber].IndexOf(findThisString);
if (strIndex > -1)
{
flag = 1;
}
}
 
 
if (flag == -1 && ((Telerik.Sitefinity.Web.PageSiteNode)(e.Item.DataItem)).ParentKey != parentPageId && e.Item.Level < 2)
{
e.Item.Remove();
}
}
else
{
e.Item.Remove();
}
 
 
}
}



When does the SiteMap.CurrentNode.NextSibling and the PreviousSibling becomes null? 
Can anyone please help me.


Thanks,
Surya.

No answers yet. Maybe you can help?

Tags
Let's talk about telerik (the good and the bad)
Asked by
Surya CD
Top achievements
Rank 1
Share this question
or