I want to have a column as row number in MVC WebGrid. How can I do it?
@{
int i=0;
foreach (var item in Model) {
@i
@Html.DisplayFor(modelItem => item.Expense)
@Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { onclick = "return confirm('Are you sure you wish to delete this record?');" })
i++;
}
}
Try this