Repeat div with foreach?

0

I have a list of registered users that displays the most important data such as name and email. I've created a div to display this data. However, I do not want to display everything in the same div, I would like to create a way to repeat this div according to the number of users registered. Is it possible to do that?

    
asked by anonymous 10.11.2014 / 18:58

1 answer

1

If you are using Razor to generate your views, you can put the creation of the divs inside the foreach loop.

@forach(var usuario in ViewBag.usuarios){
    <div>
        @usuario.nome - @usuario.email
    </div>
}
    
10.11.2014 / 19:05