Reputation: 2711
I got an action-link passing an ID to a Deletemethod in my controller.
@Html.ActionLink("Delete", "DeleteContent", new { xid = item.Id })
I would like som kind of "confirm action"-alert that gets triggered when the link is clicked. Lets say the alert has two options, "Delete" and "Cancel".
If the user hits cancel I dont want the method to excecute.
Any tips on how to accomplish that?
Upvotes: 0
Views: 242
Reputation: 39248
You can add a confirm box
@Html.ActionLink("Delete", "DeleteContent", new { xid = item.Id,onclick="return confirm('Are you sure you want to delete?');" })
Upvotes: 5