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 597 posts 1214 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 597 posts 1214 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 3008 posts 13221 karma points MVP 7x admin c-trib
    Jul 19, 2013 @ 14:05
    Jeavon Leopold
    1

    How about?

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

     

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Jul 19, 2013 @ 14:06
    Jeavon Leopold
    1

    Or if using dynamics?

    if (!CurrentPage.heroDisabled)
    {
    
    }
  • Laurence Gillian 597 posts 1214 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 3008 posts 13221 karma points MVP 7x admin c-trib
    Jul 19, 2013 @ 14:13
    Jeavon Leopold
    100

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

  • 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