I'm trying to get the values of a custom property from the children of a node in umbraco and store these values into a collections/array/list variable that can be accessed by a JavaScript code. Please advise if this is doable or if there is a better alternative. Please note I'm an Umbraco newbie. Thanks
In regards to children of the node, if it's from the current page, it's CurrentPage.Children (note: I usually type to (IPublishedContent) for intellisense). Otherwise you are using the UmbracoHelper (Umbraco.TypedContent(nodeid)).
Once you have the node, the children are access by node.Children.
In regards to the JS question, if you are using razor, you could do something like the following in your razor:
// here is the JS
<script>
var myNewArray = new[];
@foreach(var child in node.Children)
{
var prop = child.GetPropertyValue("propName");
@:myNewArray.push("@prop");
}
</script>