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?

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!

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-->
  • Should be an update to your question. ;) – trgraglia May 18 '17 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/

  • This should be a comment, not an answer. – SpartanDonut Jul 24 '15 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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