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

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

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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" %>
share|improve this answer
    
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 '12 at 21:57
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.