razor - How to use for loop in ASP.NET MVC? -
i have basic asp.net mvc project, uses c#
programming language , razor
view engine. want generate html markup for
loop in view.
<div class="item-1">item 1</div> <div class="item-2">item 2</div> <div class="item-3">item 3</div> <div class="item-4">item 4</div> <div class="item-5">item 5</div> ... <div class="item-n">item n</div>
— n
defined number in loop.
how can this?
@for(var = 1; <= 5; i++){ <div class="item-@i">item @i</div> }
Comments
Post a Comment