Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mmmoustache 50 posts 79 karma points
    Apr 25, 2012 @ 12:16
    mmmoustache
    0

    Node thinks property is not empty, when it is empty

    Hi Everyone,

    I have a site with an issue between nodes with the same doctype; this doctype has one property ('propertyA' in this example, which is a uComponents Multi-URL Picker) and I've created a razor script that should render out a div with any info inputted into 'propertyA' and if it is empty, nothing should render at all. I have two 'branches' in my content tree, every node in these has the same doctype, including the top nodes of each branch.

    My problem is that even though these groups of nodes share the same foundations, the second branch thinks that 'propertyA' is not empty, when it actually is. The razor script does exactly as it should for the nodes in the first branch, but seems to misinterpret the second branch.

    Has anybody else encountered this problem before?

    Here's my script, that's used on every node, with the same template & doctype:

    @if(@Model.HasProperty("propertyA"&@Model.GetProperty("propertyA").Value != String.Empty){
    <div>
               @foreach(var item in Model. propertyA){
                   <p>@item.linktitle</p>
               }
    </div>
    }else{
    <p>Nothing</p
    }


    So to clarify, the nodes in the first branch will render out the div only if info is inputted into 'property A'. The nodes in the second branch render the div regardless of whether the property is empty or not, but will still render out the inputted info in the property. I'm using Umbraco v4.7.1.1 and uComponents v3.0.2.


    Kind Regards,
    mmmoustache

Please Sign in or register to post replies

Write your reply to:

Draft