Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a contact controller to send a form and to save the content in a ContentList so the client can check the form submits.
var message = Services.ContentService.CreateContent(String.Format("{0} {1}", model.ContactFirstname, model.ContactLastname), CurrentPage.Id, "contactForm");
This use to work in V7, but v8 gives an error on the CurrentPage.id => cannot convert 'int' to Umbraco.Core.Udi'
Any ideas?
You need a Udi instead of a id.
You can get the Udi like this:
GuidUdi currentPageUdi = new GuidUdi(CurrentPage.ContentType.ItemType.ToString(), CurrentPage.Key);
Than use:
var message = Services.ContentService.CreateContent(String.Format("{0} {1}", model.ContactFirstname, model.ContactLastname), currentPageUdi, "contactForm");
Or just use Create instead of CreateContent :)
Create
CreateContent
I ended up using CreateAndSave Thanks!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
CurrentPage Id in V8
I have a contact controller to send a form and to save the content in a ContentList so the client can check the form submits.
This use to work in V7, but v8 gives an error on the CurrentPage.id => cannot convert 'int' to Umbraco.Core.Udi'
Any ideas?
You need a Udi instead of a id.
You can get the Udi like this:
Than use:
Or just use
Create
instead ofCreateContent
:)I ended up using CreateAndSave Thanks!
is working on a reply...