Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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