我正在爲我的研究所創建一個項目。使用Asp.net MVC,我需要選中複選框的多個刪除選項。如何使用複選框刪除多條記錄?
我在我的視圖中添加了一張支票,但未刪除多張Raw。我不想使用第三方插件。請幫幫我。
<table class="table table-striped table-condensed table-bordered">
<tr>
<th>
Select
</th>
<th>
@Html.ActionLink("Book Id", "Index", new { sortOrder = ViewBag.IdSortParm, currentFilter = ViewBag.CurrentFilter })
</th>
<th>
@Html.ActionLink("Title", "Index", new { sortOrder = ViewBag.NameSortParm, currentFilter = ViewBag.CurrentFilter })
</th>
<th>
@Html.ActionLink("Date", "Index", new { sortOrder = ViewBag.DateSortParm, currentFilter = ViewBag.CurrentFilter })
</th>
<th>
Price
</th>
<th>
Category
</th>
<th class="text-center">
Photo
</th>
<th>
User
</th>
<th>Edit</th>
<th>Delete</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
<input type="checkbox" name="deleteInputs" value="@item.BookId" />
</td>
<td>
@Html.DisplayFor(modelItem => item.BookId)
</td>
<td>
@Html.ActionLink(item.BookTitle, "Details", new
{
id = item.BookId
})
</td>
<td>
@Html.DisplayFor(modelItem => item.PublishDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.Price)
</td>
<td>
@Html.DisplayFor(modelItem => item.Category)
</td>
<td class="text-center">
<img class="img-thumbnail" width="50" height="50" src="~/ContentImages/Full/@item.Photo" />
</td>
<td>
@Html.DisplayFor(modelItem => item.UserName)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.BookId })
</td>
<td>
@Html.ActionLink("Delete", "Delete", new { id = item.BookId })
</td>
</tr>
}
</table>
到目前爲止您嘗試了什麼?與我們分享您的代碼。如果您不顯示任何您的努力,我們很難爲您提供幫助 – DevelopmentIsMyPassion
我已更新查看代碼 –
因此,您想要刪除以複選框標記的行嗎? – DevelopmentIsMyPassion