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 Guys,
I'm new to razor but not Umbraco and I'm wanting to know how to add a class to the body element if the user "checks" a checkbox within the generic properties tab.
I understand this is simple but unsure on the code to append to the body tag.
Hi Jordy
You should be able to achieve this by using the ternary operator something like this
<div class="@(CurrentPage.myProperty != String.Empty ? "myStyleOne" : null)">
This should only add the class if your property is not empty otherwise the class will be empty.
Hope this hels (and works) :)
/Jan
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Umbraco 7 | If checkbox "checked" add class to body
Hi Guys,
I'm new to razor but not Umbraco and I'm wanting to know how to add a class to the body element if the user "checks" a checkbox within the generic properties tab.
I understand this is simple but unsure on the code to append to the body tag.
Hi Jordy
You should be able to achieve this by using the ternary operator something like this
This should only add the class if your property is not empty otherwise the class will be empty.
Hope this hels (and works) :)
/Jan
is working on a reply...