i wrote this code to show list of items it works fine but i want to check the value of trainer_id for the last row in foreach to create button based on this value but i dont know how
@foreach (var item in Model.model2)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.who_reply)
</td>
<td>
@Html.DisplayFor(modelItem => item.Status)
</td>
<td>
@Html.DisplayFor(modelItem => item.Details)
</td>
@if (Convert.ToInt16(@Session["userID"]) == item.trainer_id)
{
<td>
<input class="editreply" id="editreply" type="button" value="edit" data-reply="@item.Details" data-reply_id="@item.Reply_Id" />
@*@Html.ActionLink("Edit", "Edit", new { id = Model.model1. })*@
</td>
}
thanks for your assistance