<body>
<p>
<%= Html.ActionLink("添加", "Create") %> |
<%= Html.ActionLink("编辑", "Edit") %> |
<%= Html.ActionLink("删除", "DeleteList", new { x = Html.CheckBox("chBox") }, new { onclick = "return confirm('你确定要删除该栏目?')" })%>
</p>
<table>
<tr>
<th>
<input id="Checkbox1" type="checkbox" onclick="selectAll(this)" />
</th>
<th>
类别编号
</th>
<th>
父类ID
</th>
<th>
类别名称
</th>
<th>
备注
</th>
<th>
添加人
</th>
<th>
添加时间
</th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<input name='chBox' type="checkbox" value="<%=item.NC_ID%>" />
</td>
<td>
<%= Html.Encode(item.NC_ID) %>
</td>
<td>
<%= Html.Encode(item.NC_ClassParentID) %>
</td>
<td>
<%= Html.Encode(item.NC_Name) %>
</td>
<td>
<%= Html.Encode(item.NC_Remark) %>
</td>
<td>
<%= Html.Encode(item.NC_Uname) %>
</td>
<td>
<%= Html.Encode(String.Format("{0:d}", item.NC_Time)) %>
</td>
<td>
<%= Html.Encode(item.NC1) %>
</td>
<td>
<%= Html.ActionLink("编辑", "Edit", new { id=item.NC_ID }) %> |
<%= Html.ActionLink("详细信息", "Details", new { id=item.NC_ID })%> |
<%-- <%= Html.ActionLink("删除", "Delete", new { id=item.NC_ID },--%>
<%= Html.ActionLink("删除", "Delete", new { id = item.NC_ID }, new { onclick = "return confirm('你确定要删除该随笔?')" })%>
</td>
</tr>
<% } %>
</table>
</body>
后台代码:
public ActionResult DeleteList(string[] x)
{
for (int i = 0; i <= x.Length; i++)
{
WB_News_Class news = NewsClass.GetDinner(Convert.ToInt32(x[i]));
if (news == null)
return View();
else
{
NewsClass.Delete(news);
NewsClass.Save();
return RedirectToAction("Index");
}
}
return View();
}
那位能给说下啊!或着给介绍一种解决方法!