Creating one collection from two MNTP on two child pages
Hello I have a page with two child pages below. Both child pages have a Multi Tree Node Picker. Both these tree pickers are called the same name (pageNewsPicker).
This is the code that works:
if (CurrentPage.Children().Any()) { foreach (var item in CurrentPage.Children) { var newsPicker = item.GetPropertyValue("pageNewsPicker");
if (newsPicker != String.Empty ) {
var newsList = newsPicker.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); var newsCollection = Umbraco.Content(newsList);
foreach (var news in newsCollection) {
@news.Name
}
}
} }
However as you may have suspected this approach is very limiting as its just outputting the results of the newsCollection twice, 2 objects for child page one and 2 objects for child page two
The problem being I can't sort or filter as I would like accross all the items being returned.
I want to be able to create one Collection object and insert both page (pageNewsPicker) objects into it. Then I can foreach all 4 objects and filter and sort et al.
Apologies if these is fundamental and easy peasy. I am new to MVC and am tring to do this right.
Creating one collection from two MNTP on two child pages
Hello I have a page with two child pages below. Both child pages have a Multi Tree Node Picker. Both these tree pickers are called the same name (pageNewsPicker).
This is the code that works:
However as you may have suspected this approach is very limiting as its just outputting the results of the newsCollection twice, 2 objects for child page one and 2 objects for child page two
The problem being I can't sort or filter as I would like accross all the items being returned.
I want to be able to create one Collection object and insert both page (pageNewsPicker) objects into it. Then I can foreach all 4 objects and filter and sort et al.
Apologies if these is fundamental and easy peasy. I am new to MVC and am tring to do this right.
Any pointers would be good. Thanks
I suspect the object I need is DynamicNodeList.
Can't find any syntax pointers
is working on a reply...