I'm using the example found in "Working with Pages
" in the Developers Manual and it throws an exception:
Unable to cast object of type 'Telerik.Cms.Data.CmsTemplateContent' to type 'Telerik.Cms.Data.PageTemplate'.
The sample code wasn't usable as-is, so I had to guess at a couple of things:
// create user's page
CmsManager manager = new CmsManager();
ICmsPage userPage = manager.CreatePage("Del Taco");
userPage.Navigable = true;
userPage.MenuName = "Del";
// This works. The userPage.Parent property is populated afterward
userPage.ParentID = ((ICmsPage)manager.GetPages()).ID;
// Exception here. Correct format for identifying template?
userPage.Staged.Template = manager.GetTemplate("Default");
What do you pass for the string value of GetTemplate()?
I've tried passing the name in the GUI ("Default") and passing master page file name ("Default.master"). Both raise the exception. Same with "CommunityMain"
I appreciate any pointers. This is the first snippet of code I've run against the API.