我正在为我的研究所创建一个项目。使用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