Im trying to add content in placeholder that is created inside template.
Here is root template code:
Here is code of SectionPageTemplate.cshtml template code
Layout = "~/Mvc/Views/Shared/Root.cshtml";
<div class="sfPublicWrapper" id="PublicWrapper">
In body area of SectionPageTemplate i have added content block widget.
Now based on this template i have created page and indeed i can see editable content block where users should be able add and edit content.
Now i have written api where by i have to fill text in this content block programtically. Hence im using following code to find instance of thsi content block in page which can then be populated:
using (PageManager manager = PageManager.GetManager())
PageNode page = manager.GetPageNode(pageId);
PageData pageData = page.GetPageData();
var pageDraft = manager.EditPage(pageData.Id);
IList<PageDraftControl> pageDraftControls = pageDraft.Controls;
//this list is empty
//this should return instance of contentblock widget that has been defined in template
I was expecting that the pageDraftControls List would have instance of contentblock widget control to which i would have simply added .Text = "foo bar"
What am i doing wrong?
Thanks for your help.