7

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?

3 Answers 3

8

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!

0
1

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-->
1
  • Should be an update to your question. ;) Commented May 18, 2017 at 8:36
0

FYI. Also added the solution to my blog. http://blog.amtopm.be/2013/02/05/sp2013-adding-custom-control-to-a-master-page-with-design-manager/

2
  • This should be a comment, not an answer. Commented Jul 24, 2015 at 18:26
  • Links are bad as answers. Albeit, 10 yrs later, I'm having this issue converting an old site and the blog article now no longer exists, so not helpful. Commented Jul 27, 2023 at 14:42

Your Answer

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

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