Copied to clipboard

Flag this post as spam?

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


  • Brian 24 posts 44 karma points
    May 07, 2015 @ 17:14
    Brian
    0

    Figuring out what checkboxlist was checked in the backoffice?

    Hi everyone,

    I made a checkbox list of a bunch of predefined values. I want certain aspects of the site to hide or be displayed based on if the user checked the box in the backoffice. The alias is called benefits, so when I do something like @CurrentPage.benefits, I get a comma dilemited string of everything I checked. How can I run tests on it, with say razer?

    End goal example: @{If (CurrentPage.benefits.1 == checked)
                                            <div>something</div>
                                       @If(CurrentPage.benefits.2 == checked......

    Can anyone help with that?

    Thanks!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 07, 2015 @ 19:46
    Jan Skovgaard
    0

    Hi Brian

    I think you should be able to use the .Contains method for this...so you can do something like

    @if(CurrentPage.benefits.Contains("yourvalue")){
        //Some code here
    }
    

    Does that work?

    /Jan

  • Brian 24 posts 44 karma points
    May 07, 2015 @ 21:07
    Brian
    0

    Ah. Works nicely. Thank you!

Please Sign in or register to post replies

Write your reply to:

Draft