Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mark Evans 86 posts 116 karma points
    Sep 04, 2014 @ 09:21
    Mark Evans
    0

    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?

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Sep 04, 2014 @ 09:37
    Jeroen Breuer
    0

    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

  • Mark Evans 86 posts 116 karma points
    Sep 04, 2014 @ 10:29
    Mark Evans
    0

    Surfacecontroller yes

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Sep 04, 2014 @ 10:32
    Jeroen Breuer
    0

    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

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Sep 04, 2014 @ 12:09
    Jeroen Breuer
    0

    Hello,

    Does it work if you are using CurrentPage?

    Jeroen

  • Mark Evans 86 posts 116 karma points
    Sep 04, 2014 @ 13:29
    Mark Evans
    0

    thanks, thats worked fine...

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Sep 04, 2014 @ 13:32
    Jeroen Breuer
    0

    Could you please mark a post as the solution if it helped you?

    Jeroen

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies