Copied to clipboard

Flag this post as spam?

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


  • Bob 6 posts 56 karma points
    Feb 20, 2014 @ 20:39
    Bob
    0

    Convert True/False field case

    Hi All,

    Is there a way to convert the result of a true false data type's case from mixed to lower.

    I have tried  @propertyname.ToLower() which works with a text data type, however not with a T/F data type

    Cheers,

     

     

     

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Feb 20, 2014 @ 20:47
    Dennis Aaen
    0

    Hi Bob,

    The reason why you can´t use @propertyname.ToLower() on a True/False data type is because it´s return a integer. When the checkbox is unchecked it return the value 0 and when it´s checked it return the value 1.

    /Dennis

  • Bob 6 posts 56 karma points
    Feb 20, 2014 @ 22:09
    Bob
    0

    Ah right that makes sense. Was a little confused as when I displayed the value on screen it showed the result as True or False.

    Thanks for the help

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Feb 21, 2014 @ 00:04
    Jeavon Leopold
    0

    Hi Bob,

    I think you can do @propertyName.ToString().ToLower() for what you want?

    Jeavon

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Feb 21, 2014 @ 12:44
    Jeavon Leopold
    1

    Just checked and it works fine:

    MVC Typed:

    @Model.Content.GetPropertyValue("umbracoNaviHide").ToString().ToLower()
    

    MVC Dynamic:

    @CurrentPage.umbracoNaviHide.ToString().ToLower()
    

    Razor Macro (DynamicNode)

    @Model.umbracoNaviHide.ToString().ToLower()
    
  • 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