Copied to clipboard

Flag this post as spam?

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


  • Stephanie Nicolaou 33 posts 91 karma points
    Mar 06, 2015 @ 13:58
    Stephanie Nicolaou
    0

    Nupicker XML dropdown value, not ID

    Hi all,

    I am currently working in a template and would like to show the selected value of the xml dropdown menu from the CMS for a specific page. I already have looped through the pages to show all the properties linked to each page however the nupicker value shows the ID instead of the value.

    e.g. foreach var item ....

    @item.dropdownmenuitem

    Please can somebosy tell me the syntax to show the value?

    @item.dropdownmenuitem.Label, @item.dropdownmenuitem.Name does not work.

    Steph

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 06, 2015 @ 14:17
    Hendy Racher
    0

    Hi Steph,

    There's a built in PropertyValueConver for nuPickers, so you should be able to do the following:

    Dynamic

    @{ var item = CurrentPage.myNuPickerPropertyAlias.AsDynamicPublishedContent().Single(); }

    Strongly Typed

    @{ var item = Model.Content.GetPropertyValue<Picker>("myNuPcikerPropertyAlias").AsPublishedContent().Single(); }

    HTH,

    Hendy

  • Stephanie Nicolaou 33 posts 91 karma points
    Mar 06, 2015 @ 14:53
    Stephanie Nicolaou
    0

    Hi Hendy,

    When I am already iterating through childpages like so

    [code]@foreach (var item in childpages)

    var dynamicvariable = CurrentPage.myNuPickerPropertyAlias.AsDynamicPublishedContent().Single();

    @item.myproperty[/code]

    Can you tell me how I would use the dynamic variable within my for each loop?

    I have tried @item.@dynamicvariable but it is displayed as 'Umbraco.Web.Models.DynamicPublishedContent'

    Steph

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 06, 2015 @ 16:04
    Hendy Racher
    0

    Hi Steph,

    If your variable is rendering out as 'Umbraco.Web.Models.DynamicPublishedContent', can you append .Name or whatever property you want from that dynamic obj  ?

  • Stephanie Nicolaou 33 posts 91 karma points
    Mar 06, 2015 @ 16:26
    Stephanie Nicolaou
    0

    Hi Hendy,

    I've tried:

    @dynamicvar.Name - returns  nothing
      @[email protected] - returns Umbraco.Web.Models.DynamicPublishedContent
           @item.dynamicvar.Name - returns Umbraco.Web.Models.DynamicPublishedContentList

    I am writing this from the parent template to show the child pages within it. The nupicker value is on each child page so would the follow still work?

    var dynamicvar = CurrentPage.MyNupickerAlias.AsDynamicPublishedContent().Single();

    Steph

  • Niels Odgaard 14 posts 155 karma points
    Jun 21, 2016 @ 19:43
    Niels Odgaard
    0

    Did you ever come up with a working solution for this situation?

  • Jamie Attwood 207 posts 501 karma points c-trib
    Aug 30, 2016 @ 14:04
    Jamie Attwood
    0

    Stephanie, I would also be interested if you were successful in this. Currently I am trying to resolve a property value contained in a nupicker inside the Orderby clause of a where statement. Failing that I'm looking for a way to generate another list that I can pre-populate and then resolve the picker values and do a sort based on that... any ideas apprecated.

Please Sign in or register to post replies

Write your reply to:

Draft