Reputation: 308
I've been trying to find a way to add a user control into the head section of a master page template using Kentico 9.
The usual method of
<%@ Register Src="~/CMSWebParts/Homepage/ucControl.ascx" TagPrefix="uc1" TagName="Control" %>
<uc1:Control runat="server" id="ucControl" />
does not seem to work. I'm assuming it's registered as a html template if anything.
Has anyone cam across this before and sorted it?
I'd like to know if this is possible and if so how it's implemented.
Upvotes: 0
Views: 220
Reputation: 1753
Option 1: Use the Head HTML webpart, if your stuff can be implemented in this way.
Option 2: Write macros in the masterpage layout - this works if you don't mind doing it on each master page.
Option 3: Write a webpart that instances the control then attaches it to the head. You can put this webpart into the page template that relies on said master. Your codebehind will have to move the user control to a new parent.
Option 4: Modify PortalTemplate.aspx You can put whatever you like here, but it will make hotfixes more difficult. If you're just adding a single user control this may not be a problem.
Upvotes: 0
Reputation: 519
Yes, it supports just HTML and macros, so you can either create a custom macro that does same thing as your user control or you can place your user control to the head section of the \CMSPages\PortalTemplate.aspx template that is responsible for generating all live site pages (better option would be to clone the portal template and do the customization there to avoid problems during upgrades due to customized default file)
Upvotes: 3