Il DataSourceCeid di "V4QUICKLachMenu" deve essere l'ID di un controllo di tipo IHIERACHICALDATASOURCE
-
10-12-2019 - |
Domanda
Sto cercando di effettuare una barra di navigazione a sinistra per SharePoint 2010 con questo TECKNIQ= http://www.helpmeonsharepoint.com/2012/03/custom-sharepoint-top-menu-and.html
Ho questo massaggio di errore :
.Il DataSourceID di "V4quickLaunchMenu" deve essere l'ID di un controllo di tipo IHIERACHICALDataSource. Non è stato possibile trovare un controllo con ID 'QuickLaunchSitemap'.
Errore di sorgere:
.Un'eccezione non gestita è stata generata durante l'esecuzione della richiesta Web corrente. Le informazioni relative all'origine e alla posizione dell'eccezione possono essere identificate utilizzando la traccia dello stack di eccezione sotto.
Stack Trace
.[httpxception (0x80004005): il DataSourceID di "V4QUICKLaunchMenu" deve essere l'ID di un controllo di tipo IHIERACHICALDataSource. Non è stato possibile trovare un controllo con ID 'QuickLaunchSitemap'.] System.web.ui.webcontrols.hierchicaldataboundcontrol.getdatasource () +2335265 System.web.ui.webcontrols.hierchicaldataboundcontrol.connecttohierchicaldatasource () +212 System.web.ui.webcontrols.hierchicaldataboundcontrol.onload (EventArgs e) +28 System.web.ui.control.loadRecursive () +66 System.web.ui.control.loadRecursive () +191 System.web.ui.control.loadRecursive () +191 System.web.ui.control.loadRecursive () +191 System.web.ui.control.loadRecursive () +191 System.web.ui.control.loadRecursive () +191 System.web.ui.control.loadRecursive () +191 System.web.ui.control.loadRecursive () +191 System.web.ui.page.processRequestmain (boolean includstagesbeforeaasyncpoint, boolean includstagesfterasyncpoint) +2428
Ho trovato che può avere un sacco di volte diverso sul perché questo ha apendo. Ho provato a cambiare il mio file XML senza sucSess. Spero che capirai cosa sto sbagliando.
Pubblicherò le parti del mio codice che penso sia pertinente qui è il mio codice:
in Web.config Inside Sitemap-> Provider Ho aggiunto questo:
.<add name="CustomNavigationProvider" type="BNS.Intranet.HR.CustomPortalNavigation, BNS.Intranet.HR, Version=1.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" />
CS-File
.namespace BNS.Intranet.HR { public class CustomPortalNavigation : PortalSiteMapProvider { public override SiteMapNodeCollection GetChildNodes(System.Web.SiteMapNode node) { PortalSiteMapNode pNode = node as PortalSiteMapNode; if (pNode != null) { if (pNode.Type == NodeTypes.Area) { SiteMapNodeCollection nodeColl = base.GetChildNodes(pNode); PortalSiteMapNode childNode = new PortalSiteMapNode(pNode.WebNode, "1", NodeTypes.Area, "http://sp2010dev04/navi/", "1", "1"); PortalSiteMapNode childNode1 = null; for (int i = 0; i < 20; i++) { childNode1 = new PortalSiteMapNode(childNode.WebNode, "1.1" + i, NodeTypes.Area, "http://sp2010dev04/navi", "1.1", "1.1"); } nodeColl.Add(childNode); SiteMapNodeCollection test = new SiteMapNodeCollection(); if (childNode1 != null) { test.Add(childNode1); childNode.ChildNodes = test; } return nodeColl; } else // Shouldn't it always return base.GetChildNodes? return base.GetChildNodes(pNode); } else // Only return new SiteMapNodeCollection when pNode is null? return new SiteMapNodeCollection(); }
elements.xml-file
.<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Control Id="QuickLaunchDataSource" Sequence="30" ControlClass="System.Web.UI.WebControls.SiteMapDataSource" ControlAssembly="System.Web, Version=2.0.3600.0, Culture=Neutral, PublicTokenKey=71e9bce111e9429"> <Property Name="ID">QuickLaunchSiteMap</Property> <Property Name="SiteMapProvider">CustomSiteMapProvider</Property> <Property Name="EnableSecurityTrimming">false</Property> <Property Name="EnableViewState">true</Property> <Property Name="ShowStartingNode">false</Property> <Property Name="StartingNodeOffset">0</Property> <Property Name="StartFromCurrentNode">false</Property> </Control> <HideCustomAction Id="QuickLaunch" HideActionId="QuickLaunch" GroupId="Customization" Location="Microsoft.SharePoint.SiteSettings" /> </Elements>
I miei controlli delegati nella masterpage
.<SharePoint:DelegateControl ID="DelegateControl5" runat="server" ControlId="QuickLaunchDataSource"> <Template_Controls> <asp:SiteMapDataSource SiteMapProvider="SPNavigationProvider" ShowStartingNode="False" id="QuickLaunchSiteMap" StartingNodeUrl="sid:1025" runat="server" /> </Template_Controls> </SharePoint:DelegateControl>
Due nuovi
.<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="DelegateControl8"> <Template_Controls> <asp:SiteMapDataSource ShowStartingNode="False" SiteMapProvider="SPNavigationProvider" id="SiteMapDataSource1" runat="server" StartingNodeUrl="sid:1002"/> </Template_Controls> </SharePoint:DelegateControl> <SharePoint:DelegateControl ID="DelegateControl9" runat="server" ControlId="QuickLaunchDataSource"> <Template_Controls> <asp:SiteMapDataSource SiteMapProvider="SPNavigationProvider" ShowStartingNode="False" id="SiteMapDataSource2" StartingNodeUrl="sid:1025" runat="server" /> </Template_Controls> </SharePoint:DelegateControl>
Soluzione
Try adding Both Delegate controls and it should resolve your problem.