I am trying to mark a top nav element as active so it can be styled with StaticSelectedStyle. I am comparing the parent nodes to "Home" which is the root node and top of my sitemap navigation. I have found this only works for the first set of nodes. In the code below it will work for "My Jobs" but not "About Us". However if I move About Us to be above My Jobs then it works and My Jobs does not.
I am getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
On this line: item.Selected = true;
Here is the sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode url="~/home.aspx" title="Home" description="Home">
<siteMapNode ...
Go to the complete details ...