In my main View I have a foreach loop that loops through all my patients
<tbody>
@foreach (var patient in Model.Patients)
{
<tr>
<td>@Html.DisplayFor(modelItem => patient.FirstName)</td>
<td>@Html.DisplayFor(modelItem => patient.LastName)</td>
<td>@Html.DisplayFor(modelItem => patient.PersonalID)</td>
<td>
<a asp-action="Edit" asp-route-id="@patient.Id" class="btn btn-success"><i class="glyphicon glyphicon-pencil"></i> Edit</a>
<a onclick="showDetails()" class="btn btn-success"><i class="glyphicon glyphicon-pencil"></i> Detail</a>
<form asp-action="DeleteUser" asp-route-id="@patient.Id" method="post" style="display: inline;">
<button class="btn btn-danger">
Delete
</button>
</form>
</td>
</tr>
}
</tbody>
If I add another <div></div>
<div class="col-9 detailPatient" style="color:black;">
@foreach (var doctor in Model.Doctors)
{
if (doctor.Id == patient.Id) <--------------- How do I get this patient.Id when someone clicks on the Details button. Do I need a partial View?
{
<td>@Html.DisplayFor(modelItem => doctor.FirstName)</td>
<td>@Html.DisplayFor(modelItem => doctor.LastName)</td>
<td>@Html.DisplayFor(modelItem => doctor.GodineIskustva)</td>
}
}
</div>
after the </tbody>
tag, how can I when desplay item details that are associated with my @patient.Id
?