Copied to clipboard

Flag this post as spam?

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


  • Kurt Emch 44 posts 85 karma points
    Mar 13, 2013 @ 22:41
    Kurt Emch
    0

    Loop values from a checkbox into markup

    I have a checkbox datatype set up that has prevalues for ek, k, 1, and 2.

    In my template, this is the razor:

    <div class="ico-@sampleType.sampleGradeLevel"></div>

     

     

    Which outputs this (as expected):

    <div class="ico-k,1,2"></div>

     

     

    I am trying to achieve this though:

    <div class="ico-k ico-1 ico-2"></div>

    Any ideas?

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 15, 2013 @ 01:50
    Jan Skovgaard
    0

    Hi Kurt

    I think you need to split the value you're fetching and then loop through each value to add the ico- prefix.

    Perhaps you can find some inspiration on how to do it in here http://stackoverflow.com/questions/6396866/i-have-split-a-string-into-individual-letters-using-razor-c-syntax-in-webmatr

    Hope this helps.

    /Jan

  • 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