Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

foreach 3rd item in dynamic list create new ul

$
0
0

I apologize if something like this has been answered before, I am fairly new to razor so I'm sure I am probably doing this completely wrong but I gave it my best shot and now I need help.

@{
  
  var skills Model.Children;
  
  foreach (var list in skills.Count(<= 3){
    <ul class="skills">
      @foreach(var item in list){
        <li><span style="width:@{@item.percentage};">@item.Name</span></li>
      }
    </ul>
  }
  
}

 

My Goal is for every 3rd child I want to create a new ul. Each ul will then have 3 li items underneath it. I've attempted .Count() and .Take(3) but I know I wasn't doing it correctly because I keep getting error loading macro engine script. I'm not sure if that was would even be the correct way to go about it.

 

Thanks for any help in advance. I appreciate it.

-Blake


Viewing all articles
Browse latest Browse all 72689


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>