More in this section
Forums / Designing with Sitefinity / Templates changing

Templates changing

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, 0 answered
  1. Anton Mernov
    Anton Mernov avatar
    110 posts
    03 Dec 2008
    16 Feb 2009
    Link to this post
    Hi guys,

    I have two templates: parent and child. My pages use by default parent template. How I can change (not manually) parent template on child for all pages?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    16 Feb 2009
    Link to this post
    Hi Anton,

    Here is my approach for changing pages Template and Theme programmatically.

            // new instance of CmsManager 
            CmsManager manager = new CmsManager(); 
            // create a list of pages 
            IList ListOfPages = manager.GetPages(); 
            foreach (IPage mypage in ListOfPages) 
                IPage page = manager.GetPage(mypage.ID, true); 
                // get the template 
                IPageTemplate template = manager.GetTemplate("Default"); 
                // set the template for all pages 
                page.Staged.SetTemplate(template.ID, ""); 
                // save pages 

    I hope this helps.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered