Hi, everyone!
Recently I faced another problem with SharePoint. At some moment, I got following error
where the exception says:
“The DataSourceID of ‘TopNavigationMenu’ must be the ID of a control of type IHierarchicalDataSource. A control with ID ‘topSiteMap’ could not be found.”
Also SharePoint’s ULS log contained the similar text:
Application error when access /_layouts/settings.aspx, Error=The DataSourceID of ‘TopNavigationMenu’ must be the ID of a control of type IHierarchicalDataSource. A control with ID ‘topSiteMap’ could not be found. at System.Web.UI.WebControls.HierarchicalDataBoundControl.GetDataSource() at System.Web.UI.WebControls.HierarchicalDataBoundControl.ConnectToHierarchicalDataSource() at System.Web.UI.WebControls.HierarchicalDataBoundControl.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Well, I checked where that “TopNavigationMenu” control was located and found it inside “application.master” file:
So “SharePoint:AspMenu” control pointed to”asp:SiteMapDataSource” control. But wait, ASP.NET’s SiteMapDataSource DOES implement IHierarchicalDataSource in the reallity – so the error was irrelevant. Also there wasn’t any control with ID = “topSiteMap” in this “application.master” file. Further investigation showed that this master file had been previously customized and OOTB content of it was:
and that OOTB’s “wssuc:TopNavBar” control was located in “~/_controltemplates/TopNavBar.ascx” file. The extraction of this file:
There is”SharePoint:AspMenu” control with ID = “TopNavigationMenu” pointing to “asp:SiteMapDataSource” with ID = “topSiteMap”. So it had all artifacts mentioned in the error (also please notice that “SiteMapDataSource” is located inside DelegateControl with ID = “TopNavigationDataSource“, so it could be overridden with some SharePoint feature; and, indeed, there are 2 features overriding it – OOTB’s “MySiteNavigation” and “Navigation” features activated with Publishing).
But it didn’t have any sense because “application.master” file was customized and it didn’t refer to “TopNavBar.ascx” control located inside “ControlTemplates” folder.
So – what is the reason for error description pointing to “TopNavigationMenu” control and also complaining about absence of”‘topSiteMap” control? The direct answer is:
There is no reason for that. The description of error is totally (100%) misleading.
Now – how I fixed the problem. I looked into system’s Event Log and found that there are several errors like:
it reported that, for some reasons, a DLL couldn’t loaded into SharePoint’s WebApp. OK – I fixed all things like it, but the main error about mystical “topSiteMap” control was still here.
In system Event Log, there was another error:
Hmm, it said something for Safe Mode and that SharePoint couldn’t “enter” it.
Safe Mode is a mode of SharePoint when it make security checks and allows only controls mentioned in “SafeControls” block of web.config file to be used on the pages.
Well, there is no any visible correlation between Safe Mode and the error; but I still fixed the problem with this DLL (it my case, I just deleted the reference to this control from “SafeControls” block of “web.config” file).
And, OMG, then the error disappeared!
So the real problem was with Safe Mode and not with Top Menu Navigation at all.
Hope, it helps.





