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 created a custom masterpage using the SP2013 Design Manager. I also created a SharePoint solution in Visual studio 2012 with a custom usercontrol (ascx) and custom webparts.

The masterpage works and so do the custom webparts.

However I'm not able to add the custom usercontrol to the master page. I added the @register statement to the source html page (which gets converted to a .master by SharePoint).

<!--SPM:<%@ Register Src="~/_controltemplates/15/AmToPm.Client.Intranet/FeedbackControl.ascx" TagPrefix="uc1" TagName="FeedbackControl" %>-->

And further down in my HTML

<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<uc1:FeedbackControl runat="server" id="FeedbackControl" />-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->

When running this page I get an error: "Unknown server tag 'uc1:FeedbackControl'." When I open the .master page directly the @register statement is not there. (Lost during the 'conversion'? ) Which explains the above error. All other changes I made are in the master page.

The usercontrol is deployed and present in the '_controltemplates' folder.

Has anybody tried this yet? Adding a custom ascx in a masterpage created in SP2013 Design Manager?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

I exactly had the same problem.

After some investigation and trying out different approches I finally found the solution:

1) Do NOT place the @Register-statement before the DOCTYPE declaration

2) Instead you can place it directly within your Custom ASP.NET Markup Snippet - just before the usage of your custom control

Hope that helps!

share|improve this answer
    
Thanks, one of the things you need simply to know. –  W0ut Feb 5 '13 at 12:33

Solved it thanks to JoeBlüml's answer.

I was putting my @register statements together with the default ones in the master page. Turns out you simply need to define them together with your control (and not somewhere at the top of your html page)

Like this:

<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
   <!--SPM:<%@ Register Src="~/_controltemplates/15/AmToPm.Client.Intranet/FeedbackControl.ascx" TagPrefix="uc1" TagName="FeedbackControl" %>-->    
   <!--SPM:<uc1:FeedbackControl runat="server" id="FeedbackControl" />-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->
share|improve this answer

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.