I have a multitreenode picker that is getting blog posts. On the blog posts themselves they have tags. I can't figure out how to properly render those tags. I get this error "Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object." I'm not sure how to make this work any help would be appreciated. The error happens at this line of code "foreach(var tag in post.GetPropertyValue<>
@if (node.HasValue("featuredPosts"))
{
var blog = home.Descendant("blog");
<a href="#" style="visibility: hidden;">@node.GetPropertyValue("blogText", audiences.GetPropertyValue("blogText", "Blog"))</a>
<div>
<div id="audience-blog" class="row global-spacing">
<div class="section-header column small-12">
<h1>@Html.Raw(node.GetPropertyValue("blogHeader", "DIY <span>Blog</span>"))</h1>
</div>
<div id="blog-articles">
@foreach (var post in node.GetPropertyValue<IEnumerable<IPublishedContent>>("featuredPosts"))
{
var productMultiNodeTree = post.GetPropertyValue<IEnumerable<IPublishedContent>>("productsUsed");
<div class="blog-item column small-12 medium-6">
<a href="@post.Url">
@if (post.HasValueImage("image"))
{
var i = post.GetPropertyValue<IPublishedContent>("image");
<img src="@i.Url" alt="@i.GetPropertyValue("altTag")">
}
<h3 class="h5">@post.Name</h3>
<div class="blog-type">
<ul class="product">
@foreach(var link in productMultiNodeTree)
{
<li><a href="@link.Url">@link.Name</a></li>
}
</ul>
<ul class="project">
@if(post.HasValue("tags")){
foreach(var tag in post.GetPropertyValue<IEnumerable<string>>("tags")){
<li><a href="@blogNode.Url?tag=@tag">@tag</a></li>
}
}
</ul>
</div>
</a>
</div>
}
</div>
@if (blog != null && blog.IsVisible())
{
<div class="column small-12 text-center">
<a href="@blog.Url" class="button">
@node.GetPropertyValue("viewFullBlogText", audiences.GetPropertyValue("viewFullBlogText", "View Full Blog"))
</a>
</div>
}
</div>
</div>
}
Issue rendering tags from multitreenode content
I have a multitreenode picker that is getting blog posts. On the blog posts themselves they have tags. I can't figure out how to properly render those tags. I get this error "Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object." I'm not sure how to make this work any help would be appreciated. The error happens at this line of code "foreach(var tag in post.GetPropertyValue<>
In your doc type check what the data type used for "tags" is?
Also, what version of Umbraco are you using? The storage has changed on these - it used to be a bit more complicated to use them..
https://our.umbraco.com/Documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Tags/index-vpost-7_4
If you're struggling comment out that tags bit and try adding:
And post what is output here - it should be: System.String[]
yes when I did that I got System.String[]. I am using the tags from umbraco https://our.umbraco.com/Documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Tags/index-v7 I am using version 7.13.2
I found out the issue. It was actually breaking because "blogNode" wasn't set up correctly. I had to change it. It was
I had to change it to
is working on a reply...