Revised : As per your requirenment,
You can have 3 separate form tags, one for each button. Just make sure you have an input field inside the form for the data you want to pass. For example if your action method is accepting the EmployeeId with a a parameter called EmployeeId, you should have in input hidden field with the same inside the form.
@model IEnumerable<Employee>
<table>
@foreach(var item in Model)
{
<tr>
<td>@item.EmployeeName</td>
<td>@item.EmployeeGender</td>
<td>@item.EmployeeCity</td>
<td>@item.EmployeeDateOfBirth</td>
<td>
@using(Html.BeginForm("Details","YourControllerName"))
{
<input type="hidden" name="EmployeeId" value="@item.EmployeeId" />
<input type="submit" value="Details" />
}
@using(Html.BeginForm("Edit","YourControllerName"))
{
<input type="hidden" name="EmployeeId" value="@item.EmployeeId" />
<input type="submit" value="Edit" />
}
@using(Html.BeginForm("Delete","YourControllerName"))
{
<input type="hidden" name="EmployeeId" value="@item.EmployeeId" />
<input type="submit" value="Delete" />
}
</td>
</tr>
}
* Also remember, nested forms are invalid HTML. So make sure you do not have those.
You can have 3 separate form tags, one for each button. Just make sure you have an input field inside the form for the data you want to pass. For example if your action method is accepting the EmployeeId with a a parameter called `EmployeeId`, you should have in input hidden field with the same inside the form.
@model IEnumerable<Employee>
<table>
@foreach(var item in Model)
{
<tr>
<td>@item.EmployeeName</td>
<td>@item.EmployeeGender</td>
<td>@item.EmployeeCity</td>
<td>@item.EmployeeDateOfBirth</td>
<td>
@using(Html.BeginForm("Details","YourControllerName"))
{
<input type="hidden" name="EmployeeId" value="@item.EmployeeId" />
<input type="submit" value="Details" />
}
@using(Html.BeginForm("Edit","YourControllerName"))
{
<input type="hidden" name="EmployeeId" value="@item.EmployeeId" />
<input type="submit" value="Edit" />
}
@using(Html.BeginForm("Delete","YourControllerName"))
{
<input type="hidden" name="EmployeeId" value="@item.EmployeeId" />
<input type="submit" value="Delete" />
}
</td>
</tr>
}
Also remember, nested forms are invalid HTML. So make sure you do not have those.