asp.net mvc - How can I use the foreach or for loop in razor to display the data I am trying to output? -


@foreach (var item in model.foos) {     <div>           @item.label           @item.var1           @item.var2           @item.var3           @item.var4     </div>  } 

i want display div container above first row of each of columns of table. understand logic using indexed loop instead , if how implement that. want loop go way through each row in table ad display each row separately. let me know if need me elaborate , if i'm not being clear. code above want?

i think unclear want display 1 row @ time still need go through whole table.

one way use take , skip:

@{ var first  = model.foos.take(1); }  <div>       @first.label       @first.var1       @first.var2       @first.var3       @first.var4 </div>  @foreach (var item in model.foos.skip(1)) {     ... } 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -