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.
When does the SiteMap.CurrentNode.NextSibling and the PreviousSibling becomes null?
Can anyone please help me.
Thanks,
Surya.
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.