1

My question is regarding a delegate control called TopNavigationDataSource, normally when you create a delegate control you just define there some new properties etc.

But what if I want to deploy delegate control with user control? I did it this way:

  <Control Id="TopNavigationDataSource" Sequence="10" ControlSrc="~/_controltemplates/CustomNavUserControl.ascx">
  </Control>

In CustomNavUserControl.ascx i put following:

<asp:SiteMapDataSource ShowStartingNode="False" SiteMapProvider="MySiteMapProvider"
      id="topSiteMap" runat="server" StartingNodeUrl="sid:1002"/>

But when deploying it i get an error saying:

System.Web.HttpException: The DataSourceID of 'TopNavigationMenuV4' must be the ID of a control of type IHierarchicalDataSource. A control with ID 'topSiteMap' could not be found.

What is ofcourse not true as i have just above the delegate in master page the following:

    <SharePoint:AspMenu
  ID="TopNavigationMenuV4"
  Runat="server"
  EnableViewState="false"
  DataSourceID="topSiteMap"
  AccessKey="<%$Resources:wss,navigation_accesskey%>"
  UseSimpleRendering="true"
  UseSeparateCss="false"
  Orientation="Horizontal"
  StaticDisplayLevels="2"
  MaximumDynamicDisplayLevels="1"
  SkipLinkText=""
  CssClass="s4-tn" Width="16px" Height="16px"/>

What do I miss?

1 Answer 1

3

I think the error message states that your UserControl (CustomNavUserControl.ascx) does not implement IHierarchicalDataSource. So your code behind file (CustomNavUserControl.ascx.cs) of your UserControl must implement this interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.