Thursday, 15 January 2015

asp.net - Why is row counting in MVC not working? -



asp.net - Why is row counting in MVC not working? -

in view have table, in first column sequential number (event column):

<table class="tabela"> <tr class="titles"> <th>event</th> <th>variable 1</th> <th>variable 2</th> </tr> @if (model.variables != null) { const int event = 0; foreach (var row in model.variables) { <tr align="center"> <td>@event.tostring()</td> <td>@row.variable1.first()</td> <td>@row.variable2.first()</td> @event++; </tr> } } </table>

the code above (dogodek in language event):

i have done corrections, have removed const , in foreach set @(event++)

thanks help.

you should trying this. work

@(event++) edit 1 <tr align="center"> <td>@event.tostring()</td> <td>@row.variable1.first()</td> <td>@row.variable2.first()</td> <td>@(event++)</td> </tr>

asp.net asp.net-mvc

No comments:

Post a Comment