Specify embedded template in public event control?

Posted by Community Admin on 03-Aug-2018 18:02

Specify embedded template in public event control?

All Replies

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

How can I specify an embedded template path for the event list control (screenshot attached)? I can only create markup, but I want to use an existing embedded template in one of my custom assemblies. Is there a way to do this?

Posted by Community Admin on 08-Apr-2011 00:00

Hi Basem,

You can add your embedded resource in the template selector of the events control using the PageManager to create a ControlPresentation persistent object and committing it to the DB. Here is an example:

var manager = PageManager.GetManager();
 
var template = manager.CreatePresentationItem<ControlPresentation>(Guid.NewGuid());
template.DataType = Presentation.AspNetTemplate;
template.Name = "My embedded template";
string controlType = typeof(Telerik.Sitefinity.Modules.Events.Web.UI.Public.MasterView).FullName;
template.ControlType = controlType;
template.AreaName = "Events";
//Here you have to specify '~/SFRes/' + 'the fullname of the embedded resource'. The '~/SFRes/' constant will invoke the Virtual Path Provider for embedded resources when the templateName is being resolved.
template.EmbeddedTemplateName = "~/SFRes/Telerik.Sitefinity.Resources.Templates.Frontend.Events.TitlesCitiesDatesSummariesView.ascx";
//And here the assembly where your embedded resource is.
template.ResourceAssemblyName = "Telerik.Sitefinity.Resources";
template.IsDifferentFromEmbedded = false;
manager.SaveChanges();

 Greetings,
Momo
the Telerik team

This thread is closed