Copied to clipboard

Flag this post as spam?

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


  • Jeroen Faas 4 posts 74 karma points
    Feb 23, 2016 @ 15:16
    Jeroen Faas
    0

    True/False editor always returning False

    Hello everyone, I'm an old user returning to Umbraco.

    I have been messing around with a test project to see if Umbraco is a good solution for my current client. I started working with an empty project and i'm working my way up to a proper website. I'm currently stuck on a minor issue concerning the checkboxes.

    I made a Document Type with a property to enable/disable a part of the layout, however, no matter what I select in the backend, the value of that true/false editor remains False.

    Did I do something wrong? I am using 7.4.1. Another client of mine is using Umbraco 7.2.5 and it works like a charm there.

    Thanks for reading.

  • Jeroen Faas 4 posts 74 karma points
    Feb 25, 2016 @ 09:32
    Jeroen Faas
    0

    Anyone who knows what causes this? I have not yet found the cause, and I'm going around the issue by using a radio button now.

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Feb 25, 2016 @ 10:47
    Dave Woestenborghs
    1

    Hi Jeroen,

    can you show the code on how you are retreiving the value ?

    Normally it would be something like this :

    Model.GetPropertyValue<bool>("checkboxProperty");
    

    Dave

  • Jeroen Faas 4 posts 74 karma points
    Feb 25, 2016 @ 16:29
    Jeroen Faas
    0

    I used @CurrentPage.checkboxProperty, thats how i get all Umbraco model values in the Razor views. Perhaps I failed to mention that this issue is in the templates.

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Feb 25, 2016 @ 16:30
    Dave Woestenborghs
    1

    What do you get if you do this ?

    @Model.Content.GetPropertyValue<bool>("checkboxProperty")
    

    Dave

  • Jeroen Faas 4 posts 74 karma points
    Feb 26, 2016 @ 10:52
    Jeroen Faas
    0

    Thank you, that worked. The other method I used also worked in the end.

    Apparently... when you change a composition, you have to save the types using that composition for it to work. So razor couldn't really find the property.

    Weird. Thank you for the help!

Please Sign in or register to post replies

Write your reply to:

Draft