More in this section
Forums / General Discussions / Specify embedded template in public event control?

Specify embedded template in public event control?

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 1 answered
  1. Basem
    Basem avatar
    131 posts
    22 Dec 2010
    04 Apr 2011
    Link to this post
    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?
  2. Momchil Mitev
    Momchil Mitev avatar
    13 posts
    14 Jul 2016
    08 Apr 2011
    Link to this post
    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;

    the Telerik team

2 posts, 1 answered