More in this section

Forums / General Discussions / Adding controls to pages using the APIs

Adding controls to pages using the APIs

2 posts, 0 answered
  1. Lino
    Lino avatar
    45 posts
    06 May 2005
    09 Aug 2010
    Link to this post
    Running the following code succeeds and I could see in the debugger that the page, literal, pagedraft are all well.
    Only problem is that the Page never gets the literal when I check the page out in the Sitefinity Admin

    public void insertcontentInPage()
        var pManager = PageManager.GetManager();
        var page = pManager.GetPageDataList().Where(t => t.HtmlTitle == "Lino testing
        PageDraft editPage = pManager.EditPage(page.Id, false);
        Literal simpleText = new Literal();
        simpleText.Text = "This is a simple control, added to a page.";
        PageDraftControl draftControl =
            pManager.CreateControl<PageDraftControl>(simpleText, "Header");
        pManager.PublishPageDraft(editPage.Id, true);

  2. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
    11 Aug 2010
    Link to this post
    Hello Lino,

    Thanks for reporting this. We will soon update the developers manual with a working example. 

    All the best,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered