ASP.NET MVC - how to make users confirm the delete
- by H4mm3rHead
He,
I have this page where i have checkboxes next to every item in a table, and want to allow the user to select some of them and press my delete button. I just cant come up with the jquery for making the confirm window and submitting only if 'yes' is pushed - this is my page
<%Html.BeginForm(); %>
<%List<ShopLandCore.Model.SLGroup> groups = (List<ShopLandCore.Model.SLGroup>)Model; %>
<%Html.RenderPartial("AdminWorkHeader"); %>
<table width="100%" id="ListTable" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5" class="heading">
<input type="submit" name="closeall" value="Close selected" />
<input type="submit" name="deleteall" value="Delete selected" />
</td>
</tr>
<tr>
<th width="20px">
</th>
<th>
Name
</th>
<th>
Description
</th>
<th width="150px">
Created
</th>
<th width="150px">
Closed
</th>
</tr>
<%foreach (ShopLandCore.Model.SLGroup g in groups)
{ %>
<tr>
<td>
<%=Html.CheckBox(g.Id.ToString()) %>
</td>
<td>
<%=g.Name %>
</td>
<td>
<%=g.Description %>
</td>
<td>
<%=g.Created %>
</td>
<td>
<%=g.Closed %>
</td>
</tr>
<%} %>
</table>
<%Html.EndForm(); %>
Please note that its only for the delete that it should confirm, and not necessarily for the close button.