Web Form template path not set automaticly

Vote:
 

Hello!

EPiserver CMS 7.19.2

The template path is not set automaticly when compiled and released, nor on test or prod-server. Why?

    [TemplateDescriptor(
        Path = "/Templates/Public/Pages/StartPage/StartPage.aspx")]
    [ContentType(
        GUID = "82871cdf-4a35-4026-8cf9-62fa331d7777",
        GroupName = "FOO",
        DisplayName = "StartPage Blocks",
        Description = "",
        Order = 200070,
        AvailableInEditMode = true)]
    public class FOOStartPage : StartPageBase

Am i doing something wrong?

The solution is upgraded från CMS 6 r2 PageTypeBuilder

#122726
Jun 11, 2015 9:30
Vote:
 

What's inside template model repository for this type? (code may need to be tweaked, writting from head):

ServiceLocator.Current.GetInstance<TemplateModelRepository>().GetForType<FOOStartPage>()



Is it so that usually template descriptors are added to template type (page, user control, etc) and not to page type definition? Otherwise you may need to provide "Type" to which register this template.

More info about scanning and registration process for template models you can found in my blog post series part 1 - http://blog.tech-fellow.net/2015/04/26/content-area-under-the-hood-part-1/

I know that post applies to content area, but template registration is unified.

#122727
Jun 11, 2015 9:43
Vote:
 

Hi!

The TemplateDescriptor attribute is only valid on template type (MVC controller, ASPX-page etc) as Valdis is saying and not on the ContentType definition. So you would have to add the attribute to your aspx code behind, like this:

[TemplateDescriptor(Path = "/Templates/Public/Pages/StartPage/StartPage.aspx")]
public partial class StartPage : TemplatePage<FOOStartPage>
{
}

You can find more info here:
http://world.episerver.com/documentation/items/developers-guide/episerver-cms/7/content/pages-and-blocks/how-to/creating-page-templates-and-block-controls/#PageTemplate

#122838
Edited, Jun 16, 2015 13:38
Vote:
 

yes, that works better, where did i get that from? i think it was the automatic upgrade from pagetypebuilder script. Probably i was suppose to move the TemplateDescriptor to the ASPX.

Still thought in Admin/contenttype/settings, no "Display Template" is filled in. But maybe that is legacy now?

#122839
Jun 16, 2015 14:03
Vote:
 

Display Template regulates default template for the content type. It plays small role in template selection process. You can read more about that complex process in 2nd part of blog post series: http://blog.tech-fellow.net/2015/05/30/content-area-under-the-hood-part-2/

It's focus on Contentarea, but it applies to pages as well.

#122843
Jun 16, 2015 14:57
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.