How should I initiate a delete action from my view?
Creating a new form-tag for each entity just doesn’t seem right 🙂
<% foreach (var subscriber in group.Subscribers) { %> <tr> <td><%= subscriber.Email %></td> <td><%= Html.ActionLink('[edit]', 'edit', 'subscriber', new {id=subscriber.SubscriberId}, null) %></td> <td> <form id='delete-subscriber-form' method='post' action='<%= Url.Action( 'delete', 'subscriber', new { @subscriberId = subscriber.SubscriberId }) %>'> <input type='submit' value='Delete' /> </form> </td> </tr> <% } %>
How would you do it?
I normally use checkboxes on the side of the items. Then I can have action links (buttons, whatever) that apply an action to the selected items (such as delete).