Copied to clipboard

Flag this post as spam?

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


  • Jon 47 posts 290 karma points
    Sep 27, 2017 @ 17:17
    Jon
    0

    Multinode Treepicker - fetching properties of the nodes?

    Hi :-)

    I'm using Multinode Treepicker to place different nodes in different sides. But I'm only able to get the Name of the node – not the other properties of the node?

    var ejendomsId = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("ejendomme");
    foreach (var ejendom in ejendomsId)  { 
    <h1>@ejendom.Name</h1> <!-- works fine -->
    <h2>@ejendom.adresse</h2> <!-- doesn't work -->
    }
    

    This is the error message I get:

    *Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'adresse' and no extension method 'adresse' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)*

  • Kevin Jump 2348 posts 14896 karma points MVP 8x c-trib
    Sep 27, 2017 @ 18:02
    Kevin Jump
    100

    Hi

    to get properties you have added to a node, you need to call the GetPropertyValue("name") method so for example

    @ejendom.GetPropertyValue("adresse") 
    

    should get you the property you want.

  • 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