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
I have the following Umbraco field in a template.
@Umbraco.Field("kLPArticle", recursive: true)
which is powered by Umbraco.MultiNodeTreePicker
When I add content node(s) to my page that has this Tree Picker, The results display...
1081, 1082
From my template, how can I wrap each of these category Ids with HTML so that the the final output looks like this...
<a href="/1081">category node page name </a> <a href="/1082">category node page name</a> ...
What must I do in my template?
And beyond that, is there a way to show /content-node-name, rather than /1081?
Thanks!
Hi Kensley
I think you need this code:
var categories = Umbraco.AssignedContentItem.GetPropertyValue<string>("kLPArticle", true).Split(',').Select(x => Umbraco.TypedContent(int.Parse(x))); foreach (var category in categories) { <a href="/@category.Id">@category.Name</a> }
Thanks,
Alex
awesome, how can I see all of my available property options, other than .Id and .Name? what else can I use?
based on your solution, I ended up using something like this...
@{var categories = Umbraco.AssignedContentItem.GetPropertyValue<string>("kLPArticle", true).Split(',').Select(x => Umbraco.TypedContent(int.Parse(x)));} <ul> @foreach (var category in categories){<li><a href="/@category.Id">@category.Name</a></li>} </ul>
Thank you so much!
Glad to help, have a nice weekend!
Kensley, I'm using Visual Studio, it's easy to see all properties in it.
Also you can use documentation - https://our.umbraco.org/documentation/reference/querying/ipublishedcontent/
All properties are described there.
ahhh - my next level of learning! Thanks for pointing me here.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to wrap recursive umbraco property fields with HTML
I have the following Umbraco field in a template.
@Umbraco.Field("kLPArticle", recursive: true)
which is powered by Umbraco.MultiNodeTreePicker
When I add content node(s) to my page that has this Tree Picker, The results display...
From my template, how can I wrap each of these category Ids with HTML so that the the final output looks like this...
What must I do in my template?
And beyond that, is there a way to show /content-node-name, rather than /1081?
Thanks!
Hi Kensley
I think you need this code:
Thanks,
Alex
awesome, how can I see all of my available property options, other than .Id and .Name? what else can I use?
Thanks!
based on your solution, I ended up using something like this...
Thank you so much!
Glad to help, have a nice weekend!
Kensley, I'm using Visual Studio, it's easy to see all properties in it.
Also you can use documentation - https://our.umbraco.org/documentation/reference/querying/ipublishedcontent/
All properties are described there.
Thanks,
Alex
ahhh - my next level of learning! Thanks for pointing me here.
is working on a reply...