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
Hi!.. :)
I'm currently doing some work on an Umbraco 4 installation, where i only have access to the "Settings" section.
What i want to do is very simple but i just don't know how since it's Umbraco 4 and i'm not that good at Umbraco 4 xD
But i would like it to check if the page has field, and if it has then it should check that its not empty.
In Umbraco 7 i think i would do something like this
@if(CurrentPage.HasProperty("TestProperty")) { if(CurrentPage.GetProperty("TestProperty")) { something awesome code } }
Can you guys help me? :)
It's v4.9.0 :)
Hi Anders,
If I remember right then in Umbraco 4.9.0 you only have the option to use the old DynamicNode Razor. And then the syntax should be like this:
@if(Model.HasProperty("TestProperty")) { if(Model.HasValue("TestProperty")) { something awesome code } }
Hope this helps,
/Dennis
But can i use that inside the template?
You can use this Razor code snippets in your template like your normally do.
Hmmm i just tried and it printed out in the html :/
What if you do something like this. I have totally forgot that in 4.9.0 you need to wrap the inline Razor code in a macro.
<umbraco:Macro runat="server" language="cshtml"> @if(Model.HasProperty("TestProperty")) { if(Model.HasValue("TestProperty")) { something awesome code } } </umbraco:Macro>
Nope still not working, keep the "500 - Internal server error." :(
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Check if page has field and if it has then check if its not empty
Hi!.. :)
I'm currently doing some work on an Umbraco 4 installation, where i only have access to the "Settings" section.
What i want to do is very simple but i just don't know how since it's Umbraco 4 and i'm not that good at Umbraco 4 xD
But i would like it to check if the page has field, and if it has then it should check that its not empty.
In Umbraco 7 i think i would do something like this
Can you guys help me? :)
It's v4.9.0 :)
Hi Anders,
If I remember right then in Umbraco 4.9.0 you only have the option to use the old DynamicNode Razor. And then the syntax should be like this:
Hope this helps,
/Dennis
But can i use that inside the template?
Hi Anders,
You can use this Razor code snippets in your template like your normally do.
/Dennis
Hmmm i just tried and it printed out in the html :/
Hi Anders,
What if you do something like this. I have totally forgot that in 4.9.0 you need to wrap the inline Razor code in a macro.
Hope this helps,
/Dennis
Nope still not working, keep the "500 - Internal server error." :(
is working on a reply...