Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
When creating a template using the API (new Template(path, name, alias) how do I set the Master Template so that it appears in the right place in the Umbraco back office? The content of the template sets the Layout property:
new Template(path, name, alias
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = "MasterView.cshtml"; }
but this doesn't get carried over to the "Master Template" property and I don't know how to set that in code?
A workaround is to use the old umbraco.cms.businesslogic.template namespace (yuck)
umbraco.cms.businesslogic.template
var oldTemplate = Template.GetTemplate(myTemplate.Id); oldTemplate.MasterTemplate = masterTemplate.Id; oldTemplate.Save();
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Set Master Template on a new template created through API
When creating a template using the API (
new Template(path, name, alias
) how do I set the Master Template so that it appears in the right place in the Umbraco back office? The content of the template sets the Layout property:but this doesn't get carried over to the "Master Template" property and I don't know how to set that in code?
A workaround is to use the old
umbraco.cms.businesslogic.template
namespace (yuck)is working on a reply...