Copied to clipboard

Flag this post as spam?

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


  • Stewart Israel 2 posts 22 karma points
    Mar 15, 2012 @ 19:33
    Stewart Israel
    0

    Get property from page in v5 when property is a variable.

    I'm trying to get the value of a property on a page in umbraco 5.

    I'm getting the root node using:

    var rootNode = currentPage.AncestorsOrSelf.Last();

    I can get the value of the property using:

    var x = rootNode.myProperty;

    But suppose the 'myProperty' was in a string variable, how would I be able to get the value of the property?

  • Fredrik Liljemark 52 posts 74 karma points
    Mar 15, 2012 @ 20:01
    Fredrik Liljemark
    0

    I need this too.

    Please advise.

  • R2-D2 11 posts 31 karma points
    Mar 16, 2012 @ 10:29
    R2-D2
    0

    Did you tried:

    var rootNode = DynamicModel.AncestorsOrSelf.Last();
  • Tom Fulton 2030 posts 4996 karma points c-trib
    Mar 16, 2012 @ 14:24
    Tom Fulton
    0

    Not tested, but how about:

    string myProperty = "whatever";
    @Umbraco.Field(currentPage, myProperty);

    -Tom

     

  • Stewart Israel 2 posts 22 karma points
    Mar 21, 2012 @ 05:41
    Stewart Israel
    0

    I've tried that but it doesnt work.

  • 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