I have a list collection of umbraco pages and i want to loop through checking if a bool property is true and if so i want to apply a specific class to the div
How can i write an else if ternary operator in razor to apply a class to to a div. If i wasnt using ternary then it would look like this
if package.GetPropertyValue<bool>("test")
{
<div class="test1"></div>
}
else if (package.GetPropertyValue<bool>("test1"))
{
<div class="test1"></div>
}
else if (package.GetPropertyValue<bool>("test2"))
{
<div class="test2"></div>
}
in my razor view it would be something like as follows (but not right)
<div class="@(package.GetPropertyValue<bool>("test") ? "test" : package.GetPropertyValue<bool>("test1") ? "test1" : "test2" )"></div>
Can this be done or can someone suggest how I can apply a specific class to that div when a specific condition is met?
many thanks paul