mardi 14 juin 2016

count number of row in table asp.net mvc

I am trying to count number of row of table by created from database. For example in table from database has 3 names A, B,C. It counts A:1 B:1 C:1 in table but it should be 3.

      <table class="table">
        <tr>
            <th>Student Name</th>

        </tr>
        @foreach (var item in Model.Records)
        {
             var count = 0;
            <tr>
                <td>

                    @Html.DisplayFor(modelItem => item.Student.Name)
                    @Html.DisplayFor(modelItem => item.Student.SurName)


                </td>

            </tr>
        }
    </table>

Aucun commentaire:

Enregistrer un commentaire