Copied to clipboard

Flag this post as spam?

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


  • Troels Larsen 75 posts 280 karma points
    Sep 17, 2015 @ 16:34
    Troels Larsen
    0

    Contains() solution for steve

    ill try agains sinc the entire post is fucked hope you find it :)

    //if bottomRightContent is a property and u are referencing it dynamicly
    @if (Model.Content.GetPropertyValue<string>("bottomRightContent").Contains("<|--"))
    {
    
    }
    
    //if bottomrightContent is a string property on your model use this 
    @if (Model.bottomRightContent.Contains("<|--"))
    {
    
    }
    

    I have replaced ! with |

  • Steve 472 posts 1216 karma points
    Sep 17, 2015 @ 16:49
    Steve
    0

    Thanks Troels,

    I've tried your code, but as soon as I change the "|" into the "!" it hides the script.

  • Troels Larsen 75 posts 280 karma points
    Sep 17, 2015 @ 16:52
    Troels Larsen
    0

    does it it hide your ode in the cshtml file or here at the forum ?

  • Steve 472 posts 1216 karma points
    Sep 17, 2015 @ 16:54
    Steve
    0

    It hides it in the cshtml file.

  • Troels Larsen 75 posts 280 karma points
    Sep 17, 2015 @ 16:56
    Troels Larsen
    100

    glad u got it fixed mate

  • Steve 472 posts 1216 karma points
    Sep 17, 2015 @ 19:16
    Steve
    0

    Got it!! I had to change the thing I was looking for slightly and go with the ending tag for the comment in the test.

    @if ( !Model.GetPropertyValue("bottomRightContent").EndsWith("-->") ) {
            <div class="catBox">
                <div class="catContent">
            @Model.bottomRightContent
                </div>
            </div>
        }   
    

    Thanks Troels for getting me on the right track!

Please Sign in or register to post replies

Write your reply to:

Draft