Expose current RowIndex

Mar 2, 2015 at 12:42 PM
There is a situation where I need to add html controls into the grid and I need to create the name attribute dinamically using the row index.

Is the RowIndex already exposed and if not, what's the best way to expose it?

Thanks!
Mar 11, 2015 at 12:31 PM
Edited Mar 11, 2015 at 12:32 PM
How is this?
@{
    int rowIndex = 0;
}

@Html.Grid(Model).Columns(columns =>
{
    columns.Add().RenderValueAs(row => (rowIndex++).ToString());
})