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
Is there a more simple solution to get content from multiple properties (who have the same type of content) in the same group?
Groupname
What i'm doing now is calling 4 times the content (example below)
@{ var typedMultiNodeTreePicker1 = Model.Value<IEnumerable<IPublishedContent>>("propertyOne"); if (typedMultiNodeTreePicker1 != null) { foreach (var item in typedMultiNodeTreePicker1) { <p><strong>@item.Name</strong></p> } } } @{ var typedMultiNodeTreePicker2 = Model.Value<IEnumerable<IPublishedContent>>("propertyTwo"); if (typedMultiNodeTreePicker2 != null) { foreach (var item in typedMultiNodeTreePicker2) { <p><strong>@item.Name</strong></p> } } } @{ var typedMultiNodeTreePicker3 = Model.Value<IEnumerable<IPublishedContent>>("propertyThree"); if (typedMultiNodeTreePicker3 != null) { foreach (var item in typedMultiNodeTreePicker3) { <p><strong>@item.Name</strong></p> } } } @{ var typedMultiNodeTreePicker4 = Model.Value<IEnumerable<IPublishedContent>>("propertyFour"); if (typedMultiNodeTreePicker4 != null) { foreach (var item in typedMultiNodeTreePicker4) { <p><strong>@item.Name</strong></p> } } }
Hi,
I believe there is no better way to receive the properties, but you could handle them more nicely in the view:
@{ var allTreePickers = new List<IPublishedContent>(); allTreePickers.AddRange(Model.Value<IEnumerable<IPublishedContent>>("propertyOne")); allTreePickers.AddRange(Model.Value<IEnumerable<IPublishedContent>>("propertyTwo")); allTreePickers.AddRange(Model.Value<IEnumerable<IPublishedContent>>("propertyThree")); allTreePickers.AddRange(Model.Value<IEnumerable<IPublishedContent>>("propertyFour")); if (allTreePickers.Any()) { foreach (var item in allTreePickers) { <p><strong>@item.Name</strong></p> } } }
~ Jonathan
Thanks. This works great for me! :) As a newbie I would not have figured that out.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Content from multiple properties in the same group
Is there a more simple solution to get content from multiple properties (who have the same type of content) in the same group?
Groupname
What i'm doing now is calling 4 times the content (example below)
Hi,
I believe there is no better way to receive the properties, but you could handle them more nicely in the view:
~ Jonathan
Thanks. This works great for me! :) As a newbie I would not have figured that out.
is working on a reply...