J
Jeff
hey
asp.net 2.0
The line "e.Item.Parent.ChildItems.Remove(e.Item);" gives this error:
'e.Item' threw an exception of type 'System.NullReferenceException'
System.Web.UI.WebControls.MenuItem {System.NullReferenceException}
The is the code where the exception occur:
protected void mnuSidebar_MenuItemDataBound(object sender, MenuEventArgs e)
{
string title = e.Item.Text;
if (title.Equals("Result"))
{
e.Item.Parent.ChildItems.Remove(e.Item);
}
}
This is part of my sitemap:
<siteMapNode url="~/Network.aspx" title="Network" description="" >
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="" title="ItemA" description="" />
<siteMapNode url="" title="ItemB" description="" />
<siteMapNode url="" title="ItemC" description="" />
<siteMapNode url="~/Result.aspx" title="Result" description="" />
</siteMapNode>
mnuSidebar is a menu that only displays sub menu items ("Search", "ItemA",
"ItemB" etc)
What should I do to solve this problem?
Jeff
asp.net 2.0
The line "e.Item.Parent.ChildItems.Remove(e.Item);" gives this error:
'e.Item' threw an exception of type 'System.NullReferenceException'
System.Web.UI.WebControls.MenuItem {System.NullReferenceException}
The is the code where the exception occur:
protected void mnuSidebar_MenuItemDataBound(object sender, MenuEventArgs e)
{
string title = e.Item.Text;
if (title.Equals("Result"))
{
e.Item.Parent.ChildItems.Remove(e.Item);
}
}
This is part of my sitemap:
<siteMapNode url="~/Network.aspx" title="Network" description="" >
<siteMapNode url="~/Search.aspx" title="Search" description="" />
<siteMapNode url="" title="ItemA" description="" />
<siteMapNode url="" title="ItemB" description="" />
<siteMapNode url="" title="ItemC" description="" />
<siteMapNode url="~/Result.aspx" title="Result" description="" />
</siteMapNode>
mnuSidebar is a menu that only displays sub menu items ("Search", "ItemA",
"ItemB" etc)
What should I do to solve this problem?
Jeff