For each of those nodes, I need to access the node ID's contained in a multi content picker.
For each of those node ID's, I need to retrieve a property form that node and append it to a string.
List<Node> nodes = uQuery.GetNodesByXPath("//*[@id = '1343' or @id = '1103']//*"); int sort = 0; foreach (Node item in nodes) { string propertyList = ""; //Here is where I need help the rest is pseudo code List<ContentID> ids = Node.getProperty("NodePicker") foreach (ContentID id in ids) { Node newContent = new Node(id); propertyList += newContent.getProperty("associatedProperty").Value + ","; } }
Sorry a bit late to aswer this, but thought I'd mention that uQuery also has methods to return node collections from the stored Xml / Csv values (in this case the "NodePicker" property).
List<Node> nodes = uQuery.GetNodesByXPath("//*[@id = '1343' or @id = '1103']//*"); List<Node> pickedNodes; StringBuilder stringBuilder = new StringBuilder();
foreach(Node node in nodes) { pickedNodes = uQuery.GetNodesByXml(node.GetProperty<string>("NodePicker");
Need some help traversing nodes in C#
Here's the situation:
I have List of nodes retreived using uquery.
For each of those nodes, I need to access the node ID's contained in a multi content picker.
For each of those node ID's, I need to retrieve a property form that node and append it to a string.
Any help would be appreciated.
Thanks!
Hi,
Are you storing your MNTP values as XML or CSV? If XML, something like this should work (not tested):
(using uComponents.Core.uQueryExtensions)
-Tom
If you're storing as CSV, you can use something like:
Hi,
Sorry a bit late to aswer this, but thought I'd mention that uQuery also has methods to return node collections from the stored Xml / Csv values (in this case the "NodePicker" property).
If the MNTP is storing a csv, then:
can be replaced with:
is working on a reply...