mvc view table row number counter
asp.net-mvc, model-view-controller, razor, view
Solution
Define a counter `rowNo` and write
@{ int rowNo = 0; }
@foreach (var item in Model) {
<tr style="background: @classtr;" >
<td>
@(rowNo += 1)
</td>
Problem
I have a table than shown one record of my model. for example list of category. i want to create manually row number for this table. ``` <table class="table table-striped table-bordered table-hover table-full-width dataTable"> @foreach (var item in Model) { <tr> <td> **I want to Show Row Number Here** </td> <td> @Html.ActionLink(item.Name, "ViewSubCategory", "ProductSubCategory", new { id = item.Id }, null) </td> </tr> } </table> ```