Copy Template - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Copy Template

  • Copy Template
  • Hi,

    Is there (or will there be) any way to copy (duplicate) a page template?
    I haven't found anything in SDK.
    What about saving a page as template (could be a nice feature in some cases)?

  • Hello Le Corbu,

    There is no facade or public method that you can use to duplicate a template. The current implementation allows you to duplicate PageNodes only. You can use PageManager and its GetTemplate(Guid id) method to get the template you want to duplicate and then create a new template

    PageTemplate template = null;
    masterFilePath = VirtualPathUtility.ToAppRelative(masterFilePath);
    var pageManager = PageManager.GetManager();
    template = pageManager.CreateTemplate();
    template.Name = nameFromOld;
    template.Title = nameFromOld;
    emplate.MasterPage = masterFilePathFromOld;

    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  • Hi Ivan,

    it seems to work.

    Thanks a lot!
  • Hello,
    I ma trying to achieve the same functionality. Could you please help me with how I can duplicate a template? I am fairly new to Sitefinity and have inherited a client website that requires some changes. Where should i be pasting this piece of code or is there a way to duplicate it from database itself? Please help me with this in detail. I am stuck with this problem since 2 days.
  • Hi,

    Even with the latest Sitefinity release duplication of Templates is not possible. The only way you can achieve duplication is to recreate the template manually.

    We have a PITS issue opened about this feature request where you can track on its progress and vote to increase its popularity.

    Stefani Tacheva
    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.