Copied to clipboard

Flag this post as spam?

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


  • Damien 36 posts 162 karma points
    Dec 12, 2013 @ 12:41
    Damien
    0

    Content Service - MultiNodePicker

    Hi,

    I'm just getting to grips with the content service, I wondered if anyone knew how to get values from a multinode picker, I've managed to do it but by returning the XML from the property value of productModels.

      <productModels>
           <MultiNodePicker type="content">
            <nodeId>1075</nodeId>
            <nodeId>1076</nodeId>
           </MultiNodePicker>
       </productModels>
    

    Using the content service what would be the best way to get the nodeId's from the above?

    This is what i have currently:

    var contentService = Services.ContentService;
    
            IEnumerable orderedContent = contentService.GetChildren(1070); //products node
    
            foreach (IContent content in orderedContent)
            {
                foreach (var property in content.Properties)
                {
                    this.litOutput.Text = this.litOutput.Text + property.Value;
                }
    
            }
    
  • Charles Afford 1163 posts 1709 karma points
    Dec 17, 2013 @ 22:33
    Charles Afford
    0

    Hi, are you in  a partial or view?

    If so you want to get the property using

    string[] pickerValues = yourcurrentNode (IpublishedContent).GetPropertyValue("alias of the node picker).split(",");

    //this will give you a list of ids

    foreach(string value in pickerValues)

    {

    Node pickerValue = new Node(value);

    //pickervalue is now the value that was choosen on the picker.

    }

     

    You may need to change the code a bit.  But thats the idea :).

     

    Hope this helps.  Charlie

  • Damien 36 posts 162 karma points
    Jan 02, 2014 @ 17:06
    Damien
    0

    Perfect, thanks Charlie

  • Charles Afford 1163 posts 1709 karma points
    Jan 02, 2014 @ 22:02
    Charles Afford
    0

    no worries glad i could help :)

Please Sign in or register to post replies

Write your reply to:

Draft