简体   繁体   中英

How to add custom user control in SharePoint 2013 HTML master page

I am trying to add custom usercontrol in SharePoint 2013 HTML master page, but its not working and showing the message

SharePoint can't parse this file, most likely because of an incorrectly formatted SharePoint snippet. The markup at the following location is causing problems. Edit the markup manually to fix it, or replace it with a new snippet from the Snippet Gallery.

Invalid SharePoint markup at line 145. Please repair or recreate the markup

following is the code snippet for HTML master page.

<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<%@ Register Src="~/_controltemplates/15/SharePointProject1/UserControl1.ascx" TagPrefix="uc1" TagName="MyDepartmentControl" %>-->
<!--SPM:<uc1:MyDepartmentControl runat="server" id="MyDepartmentControl1" />-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->

Please help me how i can make it possible to add asp.net user-control in SharePoint 2013 HTML Master page.

Thanks in advance.

I just solved this problem.

The answer is; convert this line

<!--SPM:<%@ Register Src="~/_controltemplates/15/SharePointProject1/UserControl1.ascx" TagPrefix="uc1" TagName="MyDepartmentControl" %>-->

to

<!--SPM:<%@ Register TagPrefix="uc1" TagName="MyDepartmentControl" Src="~/_controltemplates/15/SharePointProject1/UserControl1.ascx" %>-->

Have fun..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM