I need help! I have an ASP.NET Core 5 MVC Webapplication. I have a list with items from a .mdf-database and want at the end of a item-row a checkbox. When I am in the controller of this view, I want to have the ID of the item, which is checked. There could be more checked. But I don't know how to to this. Below some snippets from my code:
Index.cshtml
<form asp-action="Send">
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Id)
</th>
<th>
@Html.DisplayNameFor(model => model.Bez)
</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.Bez)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</td>
<td>
@Html.CheckBox("Finalized", false)
</td>
</tr>
}
</tbody>
</table>
<input type="submit" value="Send" class="btn btn-primary" />
<br /><br />
<p>Achtung! Beim Senden an einem Freitag wird der Dienstplan automatisch für den darauffolgenden Montag eingeteilt.</p>
</form>
Can someone help me? I just want the id's in a list in my controller, which are checked.
Aucun commentaire:
Enregistrer un commentaire