Hi
I am trying to get the node id of my contact page in order to redirect the user to that page after he fills the contact form.
using the surface controller I try to get the contact page id using:
var contactPage = Services.ContentTypeService.GetContentType("ConatctPage");
But I get the wrong id.
Is this the right way to use the API?
Thanks
Trying to get a node Id in surface controller
Hi I am trying to get the node id of my contact page in order to redirect the user to that page after he fills the contact form. using the surface controller I try to get the contact page id using:
But I get the wrong id. Is this the right way to use the API? Thanks
Hi Moran
Do you have more than one page based on the "ContactPage" alias? If so then that's probably the reason why you get the wrong id returned?
/Jan
Also I wouldn't use the contenttype service in your controller. This hit's the database directly.
Better way is to get your site root node. And then do a call to Descendants("ConatctPage").FirstOrDefault() from that node
Dave
Hello,
You could also place a content picker on your node and redirect to that node.
Or if it's a child node on your contact form you could just redirect to the first child node. I do the same in the Hybrid Framework: https://github.com/jbreuer/Hybrid-Framework-for-Umbraco-v7-Best-Practises/blob/master/Umbraco.Extensions/Controllers/ContactController.cs#L46
Jeroen
is working on a reply...