More in this section

Forums / Developing with Sitefinity / Cannot load template from presentation data

Cannot load template from presentation data

2 posts, 0 answered
  1. Anton Mernov
    Anton Mernov avatar
    110 posts
    03 Dec 2008
    28 Jun 2011
    Link to this post
    Hi Guys,

    I investigate the Products sample. During installation process the module creates a copy of embedded template for detail view in Design -> Widget Templates.
    I changed this template like shown below on the screenshot1.jpg but this template is not applied. I tried to re-publish page but this didn't help. The module always loads the template from the embedded resources.

    I found the following code in the Products sample:

    /// <summary>
    /// Gets or sets the layout template.
    /// </summary>
    public override ITemplate LayoutTemplate
            if (this.layoutTemplate == null)
                var tempInfo = new TemplateInfo()
                    TemplatePath = this.LayoutTemplatePath,
                    TemplateName = this.LayoutTemplateName,
                    TemplateResourceInfo = typeof(ProductsModule),
                    ControlType = this.GetType()//,
                    //Key = TemplateKey
                this.layoutTemplate = ControlUtilities.GetTemplate(tempInfo);
            return this.layoutTemplate;
            this.layoutTemplate = value;

    In the summary of the ControlUtilities.GetTemplate() methods has been written:
    // Summary:
    //     Gets a control template. The method first tries to load a template form presentation
    //     data.  If that fails the template is loaded either from virtual path or embedded
    //     resource.
    // Parameters:
    //   info:
    //     Provides information about the template to be loaded.

    Is it sufficient information to load template from presentation data in the tempInfo in the code above?
    How to force module to load template from presentation data?

    Thank in advance,
  2. Garo
    Garo avatar
    4 posts
    24 Sep 2012
    04 Jul 2011
    Link to this post
    Hi Anton Mernov,

    In case you are using SDK 4.1 SP1 or later you can remove the entire LayoutTemplate property. Take a look at how LayoutTemplatePath is implemented. Otherwise, uncomment Key = TemplateKey.

    Best wishes,
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered