I want to prompt a confirmation dialog before deleting. I found this answer here that works great
@Html.ActionLink(
"Delete",
"Delete",
new { id = post.OriginalPost.ID },
new { onclick = "return confirm('Are you sure you wish to delete this post?');" });
but as I understand in Core one should avoid the use of ActionLinks. So are there any tag-helpers or different ways to do this?
You would normally use the AnchorTagHelper
:
<a asp-action="Delete" asp-route-id="@post.OriginalPost.ID"
onclick="return confirm('Are you sure you wish to delete this post?');">Delete</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With