Sharepoint 2013

Embedding UserControls to HTML page created by Design Manager

Sharing is Caring

The design crash after you embed 2 or more User Controls in a html file.I have been figuring out a way to solve that problem today.

You can register User Controls using this statement:

[sourcecode language=”csharp”]
<!–SPM:<%@Register TagPrefix="UC" TagName="SampleUC" src="~/_controltemplates/SampleIntranet/SampleUC.ascx"%>–>
[/sourcecode]

Normally you can use;

[sourcecode language=”csharp”]
<!–MS:{UserControl registration}–>
[/sourcecode]

but when you add 2 user controls same way,design crashes.So you need to close the MS statement using “ME”.

Here’s how you can do it:

[sourcecode language=”csharp”]
<!–MS:<UC:SampleUC runat="server" id="SampleUCID">–>;
<!–ME:</UC:SampleUC>–>;
<!–MS:<UC:SampleUC2 runat="server" id="SampleUCID2">–>
<!–ME:</UC:SampleUC2>–>
[/sourcecode]

Hope that fix helps you