Copied to clipboard

Flag this post as spam?

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


  • Hein 29 posts 158 karma points
    Sep 15, 2017 @ 07:33
    Hein
    0

    How to show the retations of a nuPicker.RelationLabels on the template?

    I've got a relation between a doctor and his investigations. A doctor can have many investigations and one investigation can have many doctors.

    To select a doctor on the investigation document type, I use a nuPickers.LucenePrefetchListPicker. The relationship is bidirectional. On the doctor document type I've added a property editor nuPickers.RelationLabels. This shows me the investigations he has made.


    Inside my template on the doctor document type, I'll show the investigations he has done. Here is the property that is generated on the doctor class:

    [ImplementPropertyType("investigations")]
    public object Investigations
    {
        get { return this.GetPropertyValue("investigations"); }
    }
    

    If i call this property the result is null. My question is now: How could I show all investigations of a doctor on the doctor template?

    P.S.: I'm using Umbraco 7.6

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Sep 15, 2017 @ 08:27
    Chriztian Steinmeier
    0

    Hi Hein,

    Have a look at this Wiki page on the GitHub project - I think it explains how to get the various Pickers' values;

    Hope that helps,

    /Chriztian

  • Hein 29 posts 158 karma points
    Sep 15, 2017 @ 09:27
    Hein
    0

    Sorry this didn't work...


    I've added this code:

    public Picker InvestigationsLabels => new Picker(Id, "investigations");
    

    and calls the property using this code:

    <ul>
        @foreach (var item in Model.InvestigationsLabels.AsPublishedContent()) @* <-- on this line *@
        {
            <li>@item.ToString()</li>
        }
    </ul>
    

    This gives me an NullReferenceException on the marked line.

    After debugging I've seen this:

    PS: OnderzoekenLabels is a translation of InvestigationsLabels.

    There is the value of the nuPicker.RelationsLabels

    How could I solve this?

Please Sign in or register to post replies

Write your reply to:

Draft