Page template not available for pages that created before page template

ravi yadav asked on June 19, 2023 14:35

first i created a page in pages application of article pagetype type. after that created a page template in MVC application than when i am creating new page of article type then page template that i have created is working fine but the one page that i have created earlier is not using the template so how can in use that template for this page.

I am using Kentico 13

Correct Answer

ravi yadav answered on June 22, 2023 10:12

You can use this update sql query

update CMS_Document set DocumentPageTemplateConfiguration = '{"identifier":"PageTemplate.Page.TrackLostSavingsTemplate","properties":null}' where DocumentGUID=''

or you can update DocumentPageTemplateConfiguration column by using this

treeNode page = new DocumentQuery<TreeNode>()
                .Path("/Articles/", PathTypeEnum.Children)
                .OnSite("MySite")
                .Culture("en-us")
                .TopN(1)
                .FirstOrDefault();
                if (page != null)
                {

// Updates the "DocumentName" and "ArticleTitle" fields of the page
page.SetValue("DocumentPageTemplateConfiguration ", "{"identifier":"Your Page Template identifier ","properties":null}");


page.Update();
}

}

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on June 19, 2023 15:10

The template process is assigned during the page creation. So you have to either delete the page and re-add it or manually figure out how to modify it in the database (not recommended if using workflow or versioning).

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.