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
can i get the properties of a page from within a controller?
i have a form that when created as a page allows the email address(es) to be added as a property to indicate who the form will be emailed to.
the actual form mail is done in my controller so would like to know if i can get those email addresses there or pass them to the controller somehow?
Hello,
Does your controller inhertit from the SurfaceController or RenderMvcController? If it does you have the CurrentPage property available which is the same as Model.Content in the view.
Jeroen
Surfacecontroller yes
Ok then you can just use CurrentPage. If you add the Umbraco.Core namespace you will also get some useful extension methods like .GetPropertyValue<>.
Does it work if you are using CurrentPage?
thanks, thats worked fine...
Could you please mark a post as the solution if it helped you?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
accessing page properties in a controller
can i get the properties of a page from within a controller?
i have a form that when created as a page allows the email address(es) to be added as a property to indicate who the form will be emailed to.
the actual form mail is done in my controller so would like to know if i can get those email addresses there or pass them to the controller somehow?
Hello,
Does your controller inhertit from the SurfaceController or RenderMvcController? If it does you have the CurrentPage property available which is the same as Model.Content in the view.
Jeroen
Surfacecontroller yes
Ok then you can just use CurrentPage. If you add the Umbraco.Core namespace you will also get some useful extension methods like .GetPropertyValue<>.
Jeroen
Hello,
Does it work if you are using CurrentPage?
Jeroen
thanks, thats worked fine...
Could you please mark a post as the solution if it helped you?
Jeroen
is working on a reply...