Cannot load template from presentation data

Posted by Community Admin on 04-Aug-2018 07:02

Cannot load template from presentation data

All Replies

Posted by Community Admin on 28-Jun-2011 00:00

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
    get
    
        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;
    
    set
    
        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,
Anton

Posted by Community Admin on 04-Jul-2011 00:00

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,
Garo
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

This thread is closed