What version of Umbraco are you using? The reason I ask is that with the new MVC support in new Umbraco releases is that there is now 2 ways to do Razor in Umbraco. One way is using macroscript Razor and the other way is to use MVC Razor - And it's 2 different Razor implementations...so :)
With help from a colleague I found out (I think) what the problem has been. The property is an HTMLstring so obviously can't be checked against a string.
I've been playing around with it a bit longer and trying a different approach using @Model._columnContent which outputs the value.
However I have run into another problem. I only want to output my html if there will be a value going into it so I am trying to use HasValue to check the property. However as it may be a parent or ancestor that has the value it isn't working. Does HasValue not have an overload which allows it to check recursivly. I found this thread which suggests it does however it doesn't seem to be working.
Find first node where rich text property not empty
I want to select the first ancestor of the current node where a property that uses the editor data type is not empty.
This is the code I have so far
But I get the error "Sequence contains no elements" even though there is a node with the property set.
I assume this is something to do with the property using the editor data type as the code works if the property uses the simple text data type.
How can I change my code so it does what I need.
Hi Suzyb
What version of Umbraco are you using? The reason I ask is that with the new MVC support in new Umbraco releases is that there is now 2 ways to do Razor in Umbraco. One way is using macroscript Razor and the other way is to use MVC Razor - And it's 2 different Razor implementations...so :)
/Jan
I meant to include umbraco version in my post :/
Version is v 4.11.3
With help from a colleague I found out (I think) what the problem has been. The property is an HTMLstring so obviously can't be checked against a string.
I've been playing around with it a bit longer and trying a different approach using @Model._columnContent which outputs the value.
However I have run into another problem. I only want to output my html if there will be a value going into it so I am trying to use HasValue to check the property. However as it may be a parent or ancestor that has the value it isn't working. Does HasValue not have an overload which allows it to check recursivly. I found this thread which suggests it does however it doesn't seem to be working.
is working on a reply...