Copied to clipboard

Flag this post as spam?

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


  • Naufil 23 posts 114 karma points
    Jul 18, 2018 @ 12:07
    Naufil
    0

    repeatable text string doesn't work in loop

    how to use repeatable text string in loop.

    @foreach(ContentModels.CareersFeed career in Model.Content.Children)
    {
        {
                          if (Model.Content.GetPropertyValue<string[]>("CareersSkills").Length > 0) {
                           <ul>
                               @foreach (var item in Model.Content.GetPropertyValue<string[]>("CareersSkills")) {
                                  <li>@item</li>
                               }
                           </ul>
                         }
    }
    

    help please.. Thank you..

  • Naufil 23 posts 114 karma points
    Jul 18, 2018 @ 12:10
    Naufil
    0

    if i use this way then i got an error.

    @foreach(ContentModels.CareersFeed career in Model.Content.Children)
    {
                    <ul class="s_list">
                        <li><a href="#"><i class="fa fa-check" aria-hidden="true"></i>@career.CareersSkills</a></li>
                    </ul>
    }
    

    Error :

    System.String[]
    
  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Jul 18, 2018 @ 13:37
    Alex Skrypnyk
    100

    Hi Naufil

    What if you use this code:

    @foreach (var item in career.CareersSkills) {
        <li>@item</li>
    }
    
  • Naufil 23 posts 114 karma points
    Jul 18, 2018 @ 13:51
    Naufil
    0

    Wow, it's so simple. Thank you so much Alex.

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Jul 18, 2018 @ 13:51
    Alex Skrypnyk
    0

    You are welcome, have a nice day!

  • Naufil 23 posts 114 karma points
    Jul 18, 2018 @ 13:52
    Naufil
    0

    Same 2 u :)

  • Pedro Mendes 53 posts 258 karma points
    Jul 18, 2018 @ 12:55
    Pedro Mendes
    0

    Hey there Naufil,

    What 'version' of Umbraco 7 are you using?

  • Naufil 23 posts 114 karma points
    Jul 18, 2018 @ 13:43
    Naufil
    0

    Hi Pedro, i'm using umbraco 7.11.1

  • 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