Copied to clipboard

Flag this post as spam?

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


  • maurits 1 post 21 karma points
    Feb 06, 2012 @ 22:00
    maurits
    0

    Ultimate Picker property value

    Hello,

    I'm fairly new to the whole razor syntax and putting the pieces together for working with the syntax and an Ultimate Picker data type property.

    What I've got is a Document Type 'eventpage' which has a property on it which is based on a data type that is of the type Ultimate Picker. This DataType is set to a checkbox list which all works fine and lets me select the appropriate nodes.

    The problem I'm having is in displaying the selected nodes. I've created a razor script which should list the nodes that are selected for the current eventpage. The only thing i can get is a string list of the selected nodes, but i can't seem to get them with a separator character. So what i'm getting is: 11441042

    What i am looking for is something i can split up so that i can, for instance, get the nodes names to be displayed on the eventpage. Here is the razor code i've tried so far (some lines commented out):

    foreach (var eventpage in events.Children)
    {
    string cat = "none found";
    if (eventpage.HasProperty("Categories"))
    {
    string[] nodes = eventpage.GetPropertyValue("Categories").Split(',');
    foreach (string node in nodes)
    {
    cat += node.NodeName + "<br />";
    }
    //cat = eventpage.GetPropertyValue("Categories");
    //cat = eventpage.Categories.ToString();
    }
    }

     

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Feb 12, 2012 @ 20:47
    Sebastiaan Janssen
    0

    I think you will find the examples you need in my example site here: http://our.umbraco.org/projects/developer-tools/cultiv-razor-examples

     

Please Sign in or register to post replies

Write your reply to:

Draft