Cannot load template from presentation data
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;
//
// 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.
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