0

I have a page layout that I created on my Sharepoint 2010 site. I have created some user controls in Visual Studio that I'd like to use on my page layout. The user controls were created in a Visual Studio Sharepoint project and deployed via powershell. I have confirmed that they all have been copied to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\HRPortal.UI (the name of my project). I'm not sure if I need anything else other than the ascx files in that folder, but that's all that's in there.

Now, I'm using Sharepoint Designer to edit the page layout. I've registered the user controls with the following code:

<%@ Register TagPrefix="HRPortal" TagName="TopSection" Src="~/controltemplates/HRPortal.UI/TopSection.ascx" %>

I try to use the control with the following code:

    <HRPortal.TopSection runat="server" id="topSection" />

However, the tag doesn't get recognized and the control doesn't render any content. I've been to numerous sites on the web that detail doing it the same way, but can't get it to work. Am I doing anything wrong?

Thanks in advance

1 Answer 1

3

Are you sure you're using a period and not a colon?

<HRPortal.TopSection runat="server" id="topSection" />

should be

<HRPortal:TopSection runat="server" id="topSection" />

Also, I have an example of a working control template that has an underscore before "controltemplates":

<%@ Register TagPrefix="myPrefix" TagName="ToolBar" Src="~/_controltemplates/myControl.ascx" %>
1
  • You were right on both counts. I've been missing that colon all day long. Must already be on vacation :) Thanks!
    – Music Magi
    Dec 20, 2012 at 21:57

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.