I have a multinode treepicker with the alias "tags".
I want to get the actual names of the picks and extend them to the URL archiveLink, so that I ideally end up with something like:
http://url.com/#filters=filter1,filter2,filter3
var archiveLink = Umbraco.NiceUrl(3382);
if (CurrentPage.HasValue("tags")) {
IEnumerable<IPublishedContent> allTags = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("tags");
archiveLink += "#filters=";
foreach (var tag in allTags) {
archiveLink += tag.Name<text>,</text>;
}
}
I get this error: Object reference not set to an instance of an object. And I honestly have no clue what to do.. Yelp. :')
In the documentation you will find examples on how to get data from the multinode treepicker in Razor. You will find Razor examples for in dynamic Razor and strongly typed Razor
Get names from multinode treepicker
I have a multinode treepicker with the alias "tags". I want to get the actual names of the picks and extend them to the URL archiveLink, so that I ideally end up with something like: http://url.com/#filters=filter1,filter2,filter3
I get this error: Object reference not set to an instance of an object. And I honestly have no clue what to do.. Yelp. :')
Hi Jonas and welcome to our :-)
Try to see the documentation for the Multinode Treepicker on how to get data out using Razor https://our.umbraco.org/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Multinode-Treepicker
In the documentation you will find examples on how to get data from the multinode treepicker in Razor. You will find Razor examples for in dynamic Razor and strongly typed Razor
Hope this helps,
/Dennis
Oh damn, thank you so much Dennis. Managed to mingle some stuff together from that one.
God dag!
is working on a reply...