Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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; } }
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
Perfect, thanks Charlie
no worries glad i could help :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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.
Using the content service what would be the best way to get the nodeId's from the above?
This is what i have currently:
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
Perfect, thanks Charlie
no worries glad i could help :)
is working on a reply...