Adding propreties after creating a page programatically
Hi,
I'm having trouble programatically adding propreties to my page. Whenever I visit the page I added, Visual Studio gives me a RuntimeBinderException : 'string' does not contain a definition for 'sections'.
Here's the code I'm using
//create a new page
var newPage = ApplicationContext.Current.Services.ContentService.CreateContentWithIdentity(name, parentId, "myDocType");
//put the body text in it
newPage.SetValue("content", text);
var status = ApplicationContext.Current.Services.ContentService.SaveAndPublishWithStatus(newPage);
return String.Format("Page creation {0}!", status);
I'm using a custom Document type that has a single Textbox in it.
The program always crashes in the Fanoe.cshtml file. I realised that my Model object is weird, because it only contains the text I entered and nothing else.
Does anyone knows how I am supposed to fill the propreties of my page?
EDIT : I've found the problem : It was because I forgot to select a template for my DocumentType
Adding propreties after creating a page programatically
Hi,
I'm having trouble programatically adding propreties to my page. Whenever I visit the page I added, Visual Studio gives me a RuntimeBinderException : 'string' does not contain a definition for 'sections'.
Here's the code I'm using
I'm using a custom Document type that has a single Textbox in it.
The program always crashes in the Fanoe.cshtml file. I realised that my Model object is weird, because it only contains the text I entered and nothing else.
Does anyone knows how I am supposed to fill the propreties of my page?
EDIT : I've found the problem : It was because I forgot to select a template for my DocumentType
is working on a reply...