Copied to clipboard

Flag this post as spam?

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


  • jaco steketee 28 posts 185 karma points
    Dec 28, 2016 @ 09:03
    jaco steketee
    0

    Using TrueFalse

    Hi, im trying to create an if statement on a true false field. But its driving me mad... i keep getting errors and i dont quite understand how this works. Can someone please help me

    ive created a truefalse field named rolstoel. in my template i try:

    @if(Umbraco.Field.GetPropertyValue("rolstoel")==true)
    {
    <li><i class="icon_set_1_icon-13"></i>Toegankelijk</li>
    } 
    

    Thanks Jaco

  • Dennis Adolfi 1072 posts 6378 karma points MVP 2x c-trib
    Dec 28, 2016 @ 09:07
    Dennis Adolfi
    100

    Hi Jaco.

    So the problem is that "GetPropertyValue" returns a object, and you are comparing it against a boolean.

    Try the following:

    @if (Model.Content.GetPropertyValue<bool>("rolstoel"))
    {
        <li><i class="icon_set_1_icon-13"></i>Toegankelijk</li>
    } 
    

    Best of luck!

  • jaco steketee 28 posts 185 karma points
    Dec 28, 2016 @ 09:20
    jaco steketee
    1

    Great!!, this works perfect.Thank you very much Dennis!

  • Dennis Adolfi 1072 posts 6378 karma points MVP 2x c-trib
    Dec 28, 2016 @ 09:33
    Dennis Adolfi
    0

    Awesome jaco! Glad I could help!

    Have a great day!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies