Copied to clipboard

Flag this post as spam?

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


  • Steve 472 posts 1216 karma points
    Sep 17, 2015 @ 15:33
    Steve
    0

    Contains()

    I have a docType Parameter named "bottomRightContent" and would like to test if there is any content within it excluding the text "

  • Steve 472 posts 1216 karma points
    Sep 17, 2015 @ 15:35
    Steve
    0

    Had to re-post, because the forum left out half my post and won't let me edit it.

    Here is what is missing from my first post:

    @if ( Model.HasValue("bottomRightContent.Where.Contains(\"<!-\")") ){
            <div class="catBox">
                <div class="catContent">
            @Model.bottomRightContent
                </div>
            </div>
        }   
    

    I would like it to check the parameter to see if there is an HTML comment tag (<!--)

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

    hey Steve

    Is bottomRightContent a dynamic on your model or a string ?

    if it is a string u can use

    @if (Model.bottomRightContent.Contains("

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

    seems like the comment html comment fucks up the post :)

    if bottomRightContent is string property on your model u can do it like this

    @if (Model.bottomRightContent.Contains("<|-- ")){ }
    

    If bottomRightContent is just the alias of your property and u are referencing it dynamic try this

    @if (Model.Content.GetPropertyValue<string>("bottomRightContent").Contains("<|--")){ }
    

    I have replaced the ! with a | :)

Please Sign in or register to post replies

Write your reply to:

Draft