Another issue with Html.Menu: Object Object reference not set to an instance of an object.

Oct 25, 2009 at 6:58 PM

Hi!

I 'm trying to use 2 sitemaps in my webproject (one for the top menu and one for the left menu).

I have set a default Provider in web.config. In the site.master both sitemaps are referenced through Html.menu. When displaying the init screen  both menus show up correctly. Whenever i select an item created from the default Provider the page shows up correctly. But: as soon as i select something created from the second (not the default Provider) i get an error "Object Object reference not set to an instance of an object."

I tried to debug and found the following:

a) in file MenuHelper.cs the parameter "providerName" gets always the provider name of the default provider  and not the one i called explicitly (which is apparently wrong). In site.master i have the followingQ

<%=Html.Menu("MvcSiteMap2","","")%>

b) in file MenuHelper.cs the SiteMap.CurrentNode in line 254 is null ... tried to find why, but with no luck! (This point here is giving the actual error)

I saw a similar discussion but thought this to be different.

 

Thanks in advance

PS. Should i post a modified MvcSiteMap project for someone to have a look at?

Nov 11, 2009 at 1:53 AM

Could you not modify the the HTML helper for sub menus and create your side menu based on the parent node selection?