Copied to clipboard

Flag this post as spam?

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


  • Laurence Gillian 600 posts 1219 karma points
    Jul 19, 2013 @ 13:54
    Laurence Gillian
    0

    Razor Layout, if property equals then

    If property equals then...

    If property is not equal to 1 then { }

    If 'heroDisabled' that is a true/false field is not equal to true, then....

    @if {Umbraco.Field("heroDisabled") != '1') { @* then *@ }

    ? != operator cannot be applied

    :-( help!

  • Laurence Gillian 600 posts 1219 karma points
    Jul 19, 2013 @ 13:58
    Laurence Gillian
    0

    Just for shits and giggles! 

    <xsl:if test="$currentPage/heroDisabled != '1'">
            <!-- then -->
    </xsl:if>

    I jest! 

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 19, 2013 @ 14:05
    Jeavon Leopold
    1

    How about?

    if (!Model.Content.GetPropertyValue<bool>("heroDisabled"))
    {
    
    }

     

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 19, 2013 @ 14:06
    Jeavon Leopold
    1

    Or if using dynamics?

    if (!CurrentPage.heroDisabled)
    {
    
    }
  • Laurence Gillian 600 posts 1219 karma points
    Jul 19, 2013 @ 14:11
    Laurence Gillian
    0

    Ahha! :-) I was clearly over complicating things.

    What's the difference between the two? Performance? Readability? Explicitability (wow that's apparently a word!)

    p.s Thanks 

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 19, 2013 @ 14:13
    Jeavon Leopold
    100

    intellisense vs conciseness :-) I prefer the former...

Please Sign in or register to post replies

Write your reply to:

Draft