The DataSourceID of 'TopNavigationMenu' must be the ID of a control of type IHierarchicalDataSource. A control with ID 'topSiteMap' could not be found.
Posted
Wednesday, December 5, 2007 2:32 PM
by
C-Dog's .NET Tip of the Day
Today's topic is how to resolve the following error.
The DataSourceID of 'TopNavigationMenu' must be the ID of a control of type IHierarchicalDataSource. A control with ID 'topSiteMap' could not be found.
Go ahead, search Google for it. Good luck because you won't find a thing on it until this article happens to get indexed. It's actually not terribly difficult to fix once you know where to look. More than likely you got this after deploying a feature with some code in it. Seeing an error like that, you might think it has something to do with a master page, but in fact its not the case. Typically, you run into this error when working in partial trust (but it can occur in full trust as well).
So what's the cause? The cause is that you added something and it is preventing SharePoint from entering SafeMode. How do I know this? Event Log? Nope, it doesn't give you any info. Well it gives you some. You might notice an event that states Safe mode did not start successfully. I saw this several times when I was attempting to solve this issue, but there is no additional information. So I starting sifting through a lot of logs. If you didn't know SharePoint actually logs quite a bit of stuff to the logs folder (C:\Program Files\Common Files\Web Server Extensions\12\LOG by default). Look for the last log file scroll to the bottom and then start working your way up. If you search for safe mode you will more than likely find something. In my most recent case I saw a couple of lines like the following.
SafeControl load exception:Infragistics2.WebUI.UltraWebGrid.ExcelExport.v7.2, Version=7.2.20072.61, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb Exception: Could not load file or assembly 'Infragistics2.Excel.v7.2, Version=7.2.20072.61, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' or one of its dependencies. The system cannot find the file specified. Safe mode did not start successfully. Could not load file or assembly 'Infragistics2.Excel.v7.2, Version=7.2.20072.61, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' or one of its dependencies. The system cannot find the file specified.
Here it specifically states that it cannot load a particular DLL (No crap for using Infragistics please). In this case a new DLL was added but didnt make it into the deployment package. I simply added the file to the package and redeployed and ensured it made it to the bin folder and then everything worked fine. If you are using partial trust (and you should be), you can also run into this error if the assembly you are using does not have the proper CAS policy applied to it.
I hope this helps. It really caused our team quite a few problems from time to time until I learned how to resolve it. With most SharePoint things there wasn't a single thing in Google that helped me resolve it either. This is why I am posting this in hopes that it will the next person that runs into the issue.
Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=394