Copied to clipboard

Flag this post as spam?

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


  • JohnAss 18 posts 128 karma points
    Sep 09, 2020 @ 08:33
    JohnAss
    0

    Umbraco 8 - Getting properties in surfacecontroller / type casting

    Hi I am trying to get property values in a SurefaceController but I seems to work differently from my UmbracoViewPages in terms of getting the values.

    Heres what Im currently doing:

    enter image description here

    I would like to be able to cast the type insted of getting object. Something like I can do in the views:

    var someText = Model.Value<string>("someText");
    

    The "form" object is IPublishedContent so I dont get why I dont have the .Value

  • Søren Kottal 712 posts 4570 karma points MVP 6x c-trib
    Sep 10, 2020 @ 06:30
    Søren Kottal
    100

    Hi John

    You are probably missing a @using Umbraco.Web statement, as the Value() extension method is in there.

  • JohnAss 18 posts 128 karma points
    Sep 14, 2020 @ 07:40
    JohnAss
    0

    Thanks Søren! Solved the issue

Please Sign in or register to post replies

Write your reply to:

Draft