Create page
Hi Varinder Kumar,
You could try using SuppressSecurityChecks Property or give rights for the anonymous users to create pages.
Best wishes,
Ivan Dimitrov
the Telerik team
Hello Ivan Dimitrov,
You are not authorized to 'View 0' ('PageTemplates').
For this issue, I also tried with Owner/BackendUser checkbox (as checked), but no luck.
I am using the following code for creating a page:
Hi Varinder Kumar,
You have to grant view permissions to the user you are using in the same way as you did for "Create'. Please refer to the screenshot that I attached. It would not be possible to create a page if the user is anonymous and you have not granted Create rights.
All the best,
Ivan Dimitrov
the Telerik team
Hello Ivan Dimitrov,
Hello Varinder Kumar,
If the user is anonymous and you have not granted any rights to it form the UI it is not possible to crate a page programmatically. When you are creating a page we demand create permissions in OpenAccessPageProvider. With pages, permissions depend on the parent node - FrontEndNode rather than the security root. When you create a page with anonymous user pages permission set returns that you do not have rights. Generally SuppressSecurityChecks Property should work in this case, but we found a small glitch with OpenAccessPageProvider and its ChangeParent method. I believe that we will be able to come up with a solution about this issue before the official release. Currently I am not able to give you another option.
Kind regards,
Ivan Dimitrov
the Telerik team
Hi Ivan and Team,
Hello Ivan Dimitrov.
Hi Varinder Kumar,
Try using the code below to publish the page
var d = manager.GetPageNodes().Where(t => t.Title ==
"c"
).FirstOrDefault();
if
(d !=
null
)
PageNode node = manager.GetPageNode(
new
Guid(d.Page.Id.ToString()));
var draft = manager.GetDraft<PageDraft>(node.Page.Drafts[0].Id);
manager.PublishPageDraft(draft,
true
);
manager.SaveChanges();
Hello,
Hello Lupi,
Have you created a Draft for your page by calling SavePageDraft method ?
Best wishes,
Ivan Dimitrov
the Telerik team
Hey there,
pageData.Status = ContentLifecycleStatus.Live;
pageData.UIStatus = ContentUIStatus.Published;
Hello Lupi,
Here is a sample that shows how to create draft and publish it.
// crate a draft
var d = manager.GetPageNodes().Where(t => t.Title ==
"c"
).FirstOrDefault();
if
(d !=
null
)
PageNode node = manager.GetPageNode(
new
Guid(d.Page.Id.ToString()));
var pageDraft = manager.EditPage(node.Page.Id,
false
);
manager.SavePageDraft(pageDraft.Id);
// publish the draft later
var draft = manager.GetDraft<PageDraft>(node.Page.Drafts[0].Id);
var pageId = draft.ParentPage.Id;
manager.PublishPageDraft(draft,
true
);
Hello,
manager.PublishPageDraft(draft,
true
);
Guid tempGuid =
new
Guid(thisGuidExistsForSure);
ContentItem genericContentItem = contentManager.GetItems<ContentItem>().Where(t => t.Id == tempGuid).FirstOrDefault();
if
(genericContentItem !=
null
)
PageControl pageControl = m_PageManager.CreateControl<PageControl>(genericContentItem, containerId);
pageData.Controls.Add(pageControl);
Hello Lupi,
Try using this code
var mgr = PageManager.GetManager();
var pg = mgr.GetPageNodes().Where(t => t.Title ==
"pagetitle"
).FirstOrDefault();
var cntrl =
new
ContentBlock();
var cn = cntrl
as
Control;
// you can get container id from controls collection
var pageCtrl = mgr.CreateControl<PageControl>(cn,
"11468307001_Col00"
);
pg.Page.Controls.Add(pageCtrl);
mgr.SaveChanges();
Hello,
Hello Lupi,
1. There is no overload of CreateControl that adds ContentItem or any content object
2. You can add widgets on a page.
Regards,
Ivan Dimitrov
the Telerik team